草庐IT

ObjectCreationHandling

全部标签

c# - 使用 Newtonsoft JSON 的 ObjectCreationHandling 的说明?

我正在追踪一个错误,我注意到NewtonsoftJSON会将项目附加到List已在默认构造函数中初始化。我在C#聊天中做了更多挖掘并与一些人讨论,我们注意到此行为并不适用于所有其他集合类型。https://dotnetfiddle.net/ikNyiTusingSystem;usingNewtonsoft.Json;usingSystem.Collections.Generic;usingSystem.Collections.ObjectModel;publicclassTestClass{publicCollectionCollection=newCollection(new[]{"