Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我似乎记得有一个属性,如果它有一个默认值,或者可能只是 null,它会告诉序列化程序不包含一个字段。
谁能记得 wcf 中是否存在这样的事情?
使用 Data Contract Serializer,您可以使用 EmitDefaultValue 属性:
[DataMember(EmitDefaultValue = false)] public string position = null;