Why is using [DataMember(EmitDefaultValue = false)] not recommended?
问题 In WCF you can define a contract using the [DataContract] and [DataMember] attributes, like this: [DataContract] public class Sample { [DataMember(EmitDefaultValue = false, IsRequired = false)] public string Test { get; set; } } This article on the MSDN states that using EmitDefaultValue = false is not recommended: However, i like to use this, because the XML that is generated using this construction is cleaner. Not specifying this setting results in: <Sample> <Test xsi:nil="true"/> </Sample>