1. See More On Stackoverflow
Datamember Xml Attribute Serialization

Adding an XML Attribute to. The DataContract during serialization places any types declared with the DataMember attribute. How do I serialize a DataMember in a DataContract as an XML attribute. Data Member Default Values.. If such a data member is set to its default value (usually null or zero) and a serialization is attempted.

Data Member Default Values. 3 minutes to read. Contributors. In this article In the.NET Framework, types have a concept of default values. For example, for any reference type the default value is null, and for an integer type it is zero. It is occasionally desirable to omit a data member from serialized data when it is set to its default value.

Attribute

See More On Stackoverflow

Because the member has a default value, an actual value need not be serialized; this has a performance advantage. To omit a member from serialized data, set the property of the attribute to false (the default is true).