System.Xml.Serialization.SoapEnumAttribute Class

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

See Also: SoapEnumAttribute Members

Syntax

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

Remarks

The System.Xml.Serialization.SoapEnumAttribute class belongs to a family of attributes that controls how the System.Xml.Serialization.XmlSerializer serializes or deserializes an object as encoded SOAP XML. The resulting XML conforms to section 5 of the World Wide Web Consortium (www.w3.org) document "Simple Object Access Protocol (SOAP) 1.1". For a complete list of similar attributes, see [<topic://cpconAttributesThatControlSOAPEncodedSerialization>].

To serialize an object as an encoded SOAP message, you must construct the System.Xml.Serialization.XmlSerializer using an System.Xml.Serialization.XmlTypeMapping created with the SoapReflectionImporter.ImportTypeMapping(Type) method of the System.Xml.Serialization.SoapReflectionImporter class.

Use the System.Xml.Serialization.SoapEnumAttribute 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.SoapEnumAttribute to the enumeration member and set the SoapEnumAttribute.Name property to "Single".

You can override the SoapEnumAttribute.Name property value of a System.Xml.Serialization.SoapEnumAttribute by creating an instance of the System.Xml.Serialization.SoapEnumAttribute class and assigning it to the SoapAttributes.SoapEnum property of a System.Xml.Serialization.SoapAttributes. For details, see the System.Xml.Serialization.SoapAttributeOverrides class overview.

To serialize an object as an encoded SOAP message, you must construct the System.Xml.Serialization.XmlSerializer using an System.Xml.Serialization.XmlTypeMapping created with the SoapReflectionImporter.ImportTypeMapping(Type) method of the System.Xml.Serialization.SoapReflectionImporter class.

Note:

You can use the word SoapEnum in your code instead of the longer System.Xml.Serialization.SoapEnumAttribute.

For more information about using attributes, see [<topic://cpconExtendingMetadataUsingAttributes>].

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