毕业论文开发语言企业开发JAVA技术.NET技术WEB开发Linux/Unix数据库技术Windows平台移动平台嵌入式论文范文英语论文
您现在的位置: 毕业论文 >> net技术 >> 正文

Newtonsoft.Json.JsonSerializationException: Self referencing loop

更新时间:2013-4-18:  来源:毕业论文
毕业论文 


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for Menu
/// </summary>
public class Menu
{
    public Menu()
    {
        //
        // TODO: Add constructor logic here
        //
    }

    public int ID { get; set; }

    public int ParentMenuID { get; set; }

    public string MenuName { get; set; }

    public string MenuCode { get; set; }

    public string MenuClickURL { get; set; }

}

 

 4、使用的构造JSON数据格式的类(此类不是本人写的,来源于互联网)


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text;
using System.Reflection;
using System.Collections;
using System.Data;
using System.Data.Common;

/// <summary>
/// Summary description for FormatToJson
/// </summary>
public class FormatToJson
{
    public FormatToJson()
    {
        //
        // TODO: Add constructor logic here
        //
    }
    /// <summary> 
    /// List转成json  
    /// </summary> 
    /// <typeparam name="T"></typeparam> 
    /// <param name="jsonName"></param> 
    /// <param name="list"></param> 
    /// <returns></returns> 
    public static string ListToJson<T>(IList<T> list, string jsonName)
    {
        StringBuilder Json = new StringBuilder();
        if (string.IsNullOrEmpty(jsonName))
            jsonName = list[0].GetType().Name;
        Json.Append("{\"" + jsonName + "\":[");
        if (list.Count > 0)
        {
            for (int i = 0; i < list.Count; i++)
            {
                T obj = Activator.CreateInstance<T>();
            

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  ... 下一页  >> 

设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©chuibin.com 优尔论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。