Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

XmlAttributeOverrides.Add Method (Type, XmlAttributes)

Adds an XmlAttributes object to the collection of XmlAttributes objects. The type parameter specifies an object to be overridden by the XmlAttributes object.

Namespace:  System.Xml.Serialization
Assembly:  System.Xml.Serialization (in System.Xml.Serialization.dll)

public void Add(
	Type type,
	XmlAttributes attributes
)

Parameters

type
Type: System.Type
The Type of the object that is overridden.
attributes
Type: System.Xml.Serialization.XmlAttributes
An XmlAttributes object that represents the overriding attributes.

ExceptionCondition
InvalidOperationException

More than one XmlAttributes object was added for a member of some type.

The XmlAttributes object contains a union of attribute objects that cause the XmlSerializer to override its default serialization behavior for a set of objects. You choose the attribute objects to place in the XmlAttributes object, depending on the particular behaviors you want to override. For example, the 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 XmlAttributeAttribute, assign it to the XmlAttribute property of an XmlAttributes, and add the XmlAttributes object to the XmlAttributeOverrides object.

Use this overload to override an XmlRootAttribute or XmlTypeAttribute.

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2015 Microsoft