Is it possible to instruct WCF not to serialize fields, which values are the default for the field type?
Inspecting the soap-xm开发者_如何学JAVAl produced by WCF I notice that many fields appear with their default values. Is it possible to instruct WCF somehow to omit such fields in serialization?
Thanks.
Yes. If you're using DataContractSerializer, apply
[DataMember(EmitDefaultValue=false)]
to these fields.
精彩评论