我有一個自定義集合(實現IList),它具有一些自定義屬性,如下所示:class FooCollection : IList<Foo> { private List<Foo> _foos = new List<Foo>(); public string Bar { get; set; } //Implement IList, ICollection and IEnumerable members...}序列化時,使用以下代碼:JsonSerializerSettings jss = new JsonSerializerSettings() { TypeNameHandling = TypeNameHandling.Auto};string serializedCollection = JsonConvert.SerializeObject( value , jss );它正確地序列化和反序列化所有收集項;但是,FooCollection不會考慮該類中的任何其他屬性。無論如何,有沒有將它們包括在序列化中?
- 3 回答
- 0 關注
- 640 瀏覽
添加回答
舉報
0/150
提交
取消