System.Runtime.Serialization 4.0.0.0 System.Attribute System.AttributeUsage(System.AttributeTargets.Property | System.AttributeTargets.Field | System.AttributeTargets.All, AllowMultiple=false, Inherited=false)

Apply the attribute in conjunction with the to identify members of a type that are part of a data contract. One of the serializers that can serialize data contracts is the .

The data contract model is an "opt-in" model. Applying the to a field or property explicitly specifies that the member value will be serialized. In contrast, the serializes public and private fields of a type, and the serializes only public fields and properties of a type.

You can apply the to private fields or properties. Be aware that the data returned by the member (even if it private) will be serialized and deserialized, and thus can be viewed or intercepted by a malicious user or process.

By default, the CLR member name is used as the name of the data member. By setting the property, you can customize the name of the data member. This can be used to provide a name that may not be allowed as a CLR member name. When mapping to XML using the , this name is used as the name of the schema element in a type.

Properties to which the attribute has been applied must have both get and set fields; they cannot be get-only or set-only.

For more information about data contracts and data members, see Using Data Contracts. For more information about member names, see Data Member Default Values.

When applied to the member of a type, specifies that the member is part of a data contract and is serializable by the .

- Constructor
  4.0.0.0
  To be added.

  Initializes a new instance of the class.

- Property
  4.0.0.0
  System.Boolean To be added.

  In the dnprdnshort, 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 0. It is occasionally desirable to omit a data member from the serialized data when it is set to its default value. To do this, set the property to false (it is true by default).

  Setting the property to false is not a recommended practice. It should only be done if there is a specific need to do so (such as for interoperability or to reduce data size).

  Gets or sets a value that specifies whether to serialize the default value for a field or property being serialized.

- Property
  4.0.0.0
  System.Boolean To be added.

  The property is used for ensuring compatibility with future versions of a type. For more information, see Data Contract Versioning and Best Practices: Data Contract Versioning.

  Gets or sets a value that instructs the serialization engine that the member must be present when reading or deserializing.

- Property
  4.0.0.0
  System.String To be added.

  This property is used to override the default name of the data member that is derived from the name of the member annotated with the .

  The property enables you to use names that are not permitted as common language runtime (CLR) identifiers. In addition, this property enables the type author to define a data member name separate from the CLR member name. This separate definition helps in versioning scenarios (changing the CLR member name without breaking the data contract) and allows a different naming convention for data contact members and CLR members.

  Gets or sets a data member name.

- Property
  4.0.0.0
  System.Int32 To be added.

  If a type requires that one member be serialized or deserialized before another, use this property to specify the order. For more information, see Data Member Order.

  Gets or sets the order of serialization and deserialization of a member.