开发者

Is it possible to instruct WCF not to serialize fields, which values are the default for the field type?

开发者 https://www.devze.com 2022-12-17 06:46 出处:网络
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?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消