How to handle enumerations?

Jul 19, 2009 at 11:20 PM
Edited Jul 19, 2009 at 11:22 PM

Here is an extremely simple snippet from a schema.

<xsd:simpleType name="TransResponseCodeType">
  <xsd:restriction base="xsd:normalizedString">
   <xsd:enumeration value="Always"/>
   <xsd:enumeration value="OnError"/>

Here is the corresponding code that was generated to represent this schema element.

  [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.3074")]
  [System.Xml.Serialization.XmlTypeAttribute(Namespace = "")]
  public enum TransResponseCodeType

    /// <remarks/>

    /// <remarks/>

The problem occurs when trying to use this code to programatically populate the value.  The object generated in code requires the value to be an Integer, but the actual valid values are the literal String values "Always" or "OnError".  Is there a solution that will allow the object value to be populated programatically using the generated code?