日期:2014-05-17 浏览次数:20768 次
class Program
{
static void Main(string[] args)
{
Data info = new Data(new List<InnerData>() { new InnerData(3), new InnerData(4) }, 5);
string strJson = JsonConvert.SerializeObject(info);
Console.WriteLine(strJson);
}
}
public class Data
{
public Data(List<InnerData> orderitems, int optype)
{
this.orderitems = orderitems;
this.optype = optype;
}
public List<InnerData> orderitems { get; set; }
public int optype { get; set; }
}
public class InnerData
{
public InnerData(int id)
{
this.id = id;
}
public int id { get; set; }
}