[ACCEPTED]-Why is using [DataMember(EmitDefaultValue = false)] not recommended?-datamember

Accepted answer
Score: 23

The reason is at the bottom of the article 13 that you link to. The short version is:

  • When 12 the EmitDefaultValue is set to false, it is represented 11 in the schema as an annotation specific 10 to Windows Communication Foundation (WCF). There 9 is no interoperable way to represent this 8 information. In particular, the "default" attribute 7 in the schema is not used for this purpose, the 6 minOccurs attribute is affected only by the IsRequired setting, and 5 the nillable attribute is affected only by the type 4 of the data member.

  • The actual default value 3 to use is not present in the schema. It 2 is up to the receiving endpoint to appropriately 1 interpret a missing element.

More Related questions