System.Xml.Serialization.XmlAttributes.XmlAttribute Property

Gets or sets an object that specifies how the System.Xml.Serialization.XmlSerializer serializes a public field or public read/write property as an XML attribute.

Syntax

public XmlAttributeAttribute XmlAttribute { get; set; }

Value

Documentation for this section has not yet been entered.

Remarks

By default, if no attribute is applied to a public field or public read/write property, it is serialized as an XML element. You can also instruct the System.Xml.Serialization.XmlSerializer to generate an XML attribute by applying an System.Xml.Serialization.XmlAttributeAttribute to the field or property.

The XmlAttributes.XmlAttribute property allows you to override the default serialization, as well as the serialization controlled by applying an System.Xml.Serialization.XmlAttributeAttribute to the member. To do this, create an System.Xml.Serialization.XmlAttributeAttribute and set its properties (such as XmlAttributeAttribute.AttributeName). Assign the new object to the XmlAttributes.XmlAttribute property of an System.Xml.Serialization.XmlAttributes object. Add the System.Xml.Serialization.XmlAttributes object to an System.Xml.Serialization.XmlAttributeOverrides object and specify the type of the object that contains the field or property, and the name of the field or property. Lastly, create an System.Xml.Serialization.XmlSerializer using the System.Xml.Serialization.XmlAttributeOverrides object and call the XmlSerializer.Serialize(System.IO.TextWriter, object) or XmlSerializer.Deserialize(System.IO.Stream) method.

Requirements

Namespace: System.Xml.Serialization
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0