System.Xml.Serialization.XmlEnumAttribute Class

Controls how the System.Xml.Serialization.XmlSerializer serializes an enumeration member.

See Also: XmlEnumAttribute Members

Syntax

[System.AttributeUsage(System.AttributeTargets.Field)]
public class XmlEnumAttribute : Attribute

Remarks

The System.Xml.Serialization.XmlEnumAttribute belongs to a family of attributes that controls how the System.Xml.Serialization.XmlSerializer serializes or deserializes an object. For a complete list of similar attributes, see Attributes That Control XML Serialization.

Use the System.Xml.Serialization.XmlEnumAttribute to change the enumeration that the System.Xml.Serialization.XmlSerializer generates or recognizes (when it serializes or deserializes a class, respectively). For example, if an enumeration contains a member named One, but you prefer that the XML output be named Single, apply the System.Xml.Serialization.XmlEnumAttribute to the enumeration member and set the XmlEnumAttribute.Name property to "Single".

You can override the XmlEnumAttribute.Name property value of an System.Xml.Serialization.XmlEnumAttribute by creating an instance of the System.Xml.Serialization.XmlEnumAttribute class and assigning it to the XmlAttributes.XmlEnum property of an System.Xml.Serialization.XmlAttributes object. For details, see the System.Xml.Serialization.XmlAttributeOverrides class.

Note:

You can use the word XmlEnum in your code instead of the longer System.Xml.Serialization.XmlEnumAttribute.

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