The SoapEnumAttribute class belongs to a family of attributes that controls how the 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 Attributes That Control Encoded SOAP Serialization.
To serialize an object as an encoded SOAP message, you must construct the XmlSerializer using an XmlTypeMapping created with the ImportTypeMapping method of the SoapReflectionImporter class.
Use the SoapEnumAttribute to change the enumeration that the 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 SoapEnumAttribute to the enumeration member and set the Name property to "Single".
You can override the Name property value of a SoapEnumAttribute by creating an instance of the SoapEnumAttribute class and assigning it to the SoapEnum property of a SoapAttributes. For details, see the SoapAttributeOverrides class overview.
To serialize an object as an encoded SOAP message, you must construct the XmlSerializer using an XmlTypeMapping created with the ImportTypeMapping method of the SoapReflectionImporter class.
Note: |
|---|
You can use the word
SoapEnum in your code instead of the longer SoapEnumAttribute.
|
For more information about using attributes, see Extending Metadata Using Attributes.