class Program
{
static void Main(string[] args)
{
string json = JsonConvert.SerializeObject(new Account { Name = "test" }, Newtonsoft.Json.Formatting.Indented,
new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All, PreserveReferencesHandling = PreserveReferencesHandling.Objects });
Console.Out.Write(json);
while (true)
{
}
}
}
class Account {
public String Name;
}
嘿,我想进入 Json。我想反序列化一个对象。我想从字符串中获取类型信息。因此,当我反序列化时,我希望 json 自己识别类型而不指定它。那可能吗?
最好的问候,布赖恩