System.Xml.Serialization.XmlAttributeOverrides.Add Method

Adds an System.Xml.Serialization.XmlAttributes object to the collection of System.Xml.Serialization.XmlAttributes objects. The type parameter specifies an object to be overridden. The member parameter specifies the name of a member that is overridden.

Syntax

public void Add (Type type, string member, XmlAttributes attributes)

Parameters

type
The Type of the object to override.
member
The name of the member to override.
attributes
An System.Xml.Serialization.XmlAttributes object that represents the overriding attributes.

Remarks

The System.Xml.Serialization.XmlAttributes object contains a union of attribute objects that cause the System.Xml.Serialization.XmlSerializer to override its default serialization behavior for a set of objects. You choose the attribute objects to place in the System.Xml.Serialization.XmlAttributes object, depending on the particular behaviors you want to override. For example, the System.Xml.Serialization.XmlSerializer serializes a class member as an XML element by default. If you want the member to be serialized as an XML attribute instead, you would create an System.Xml.Serialization.XmlAttributeAttribute, assign it to the XmlAttributes.XmlAttribute property of an System.Xml.Serialization.XmlAttributes, and add the System.Xml.Serialization.XmlAttributes object to the System.Xml.Serialization.XmlAttributeOverrides object.

Use this method when attempting to override an System.Xml.Serialization.XmlElementAttribute, System.Xml.Serialization.XmlAttributeAttribute, System.Xml.Serialization.XmlArrayAttribute, System.Xml.Serialization.XmlArrayItemAttribute, or System.Xml.Serialization.XmlIgnoreAttribute.

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