System.Xml.Serialization.XmlAnyAttributeAttribute Class

Specifies that the member (a field that returns an array of System.Xml.XmlAttribute objects) can contain any XML attributes.

See Also: XmlAnyAttributeAttribute Members

Syntax

[System.AttributeUsage(System.AttributeTargets.Property | System.AttributeTargets.Field | System.AttributeTargets.Parameter | System.AttributeTargets.ReturnValue | System.AttributeTargets.All)]
public class XmlAnyAttributeAttribute : Attribute

Remarks

Use the System.Xml.Serialization.XmlAnyAttributeAttribute to contain arbitrary data (as XML attributes) that is sent as part of an XML document, such as, metadata sent as part of the document.

Apply the System.Xml.Serialization.XmlAnyAttributeAttribute to a field that returns an array of System.Xml.XmlAttribute or System.Xml.XmlNode objects. When the XmlSerializer.Deserialize(System.IO.Stream) method of the System.Xml.Serialization.XmlSerializer class is called, all XML attributes that do not have a corresponding member in the class being deserialized are collected in the array. After deserialization, you can iterate through the collection of System.Xml.XmlAttribute items to process the data.

The XmlSerializer.UnknownNode and XmlSerializer.UnknownAttribute events of the System.Xml.Serialization.XmlSerializer do not occur if you apply the System.Xml.Serialization.XmlAnyAttributeAttribute to a member of a class.

Note:

You can use the word XmlAnyAttribute in your code instead of the longer System.Xml.Serialization.XmlAnyAttributeAttribute.

For more information about using attributes, see Extending Metadata Using Attributes.

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