Gets the collection of XmlAnyElementAttribute objects to override.
Assembly: System.Xml (in System.Xml.dll)
The XmlAnyElementAttribute can be applied to a member that returns an array of XmlElement objects on deserialization. This allows the XmlSerializer to deserialize any elements that do not have a corresponding member in the object being deserialized--thus those elements are "unknown" to the XmlSerializer. This is useful when the XML stream has been altered by an XML Web service, or when it is known that random data is always included with the XML stream.
The property allows you to override the serialization of a member to function as a member to which the XmlAnyElementAttribute has been applied.
The following example creates a new XmlAnyElementAttribute object and adds it to the collection of objects accessed through the property. The XmlAttributes object is then added to a XmlAttributeOverrides object which is used to create an XmlSerializer object. The XmlSerializer is used to serialize or deserialize an object. To see the effect of using the XmlAnyElementAttributes property, create an XML document named "UnknownElements.xml" by running the SerializeObject method in the Main method. Edit the resulting document to include other (unknown) elements. Comment out the SerializeObject call in the Main method, and uncomment the call to the DeserializeObject method, which prints out the name and value of any unknown XML element.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.