1.创建一个对象City.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace JSONDemo
{
public class City
{
public string Country { get; set; }
public IList<string> Name { get; set; }
public City()
{
this.Name = new List<string>
{
"Auckland",
"Wellington",
"Hamilton"
};
}
}
}
2.序列化对象与反序列化对象
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using GongHuiNewtonsoft.Json;
using GongHuiNewtonsoft.Json.Serialization;
using GongHuiNewtonsoft.Json.Converters;
namespace JSONDemo
{
class Program
{
static void Main(string[] args)
{
JsonConvert.DefaultSe