Export (0) Print
Expand All

XmlAttributes.XmlEnum Property

Gets or sets an object that specifies how the XmlSerializer serializes an enumeration member.

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

member XmlEnum : XmlEnumAttribute with get, set

Property Value

Type: System.Xml.Serialization.XmlEnumAttribute
An XmlEnumAttribute that specifies how the XmlSerializer serializes an enumeration member.

For each identifier you want to override, you must create an XmlAttributes object, and set the XmlEnum property to an XmlEnumAttribute that overrides the identifier. Add the XmlAttributes object to the XmlAttributeOverrides object and specify both the Type of the class that contains the enumeration, and the overridden member name.

The following example serializes two classes named Food and FoodType. The FoodType class contains two enumerations that are overridden and, for each enumeration, the example creates an XmlEnumAttribute object that it assigns to the XmlEnum property of an XmlAttributes object. The example then adds the XmlAttributes object to an XmlAttributeOverrides object, which is used to create an XmlSerializer.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

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.

Community Additions

© 2014 Microsoft