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 XmlAnyElementAttribute has been applied.property allows you to override the serialization of a member to function as a member to which the
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.
Available since 8
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Available since 8.1