public class People { public string name { get; set; } public string age { get; set; } public string sex { get; set; } }List<People> list = new List<People>(); list.Add(new People { name = "Jane", age = "18", sex = "female" }); list.Add(new People { name = "Lucy", age = "21", sex = "female" }); list.Add(new People { name = "Anne", age = "20", sex = "female" });
string str = JsonConvert.SerializeObject(list);//序列化 List<People> peopleList = JsonConvert.DeserializeObject<List<People>>(str);//反序列化
新闻热点
疑难解答