title: WCF Serialising Enums using Message Contracts
body: <p>I have some web services that use Message contracts. It's probably worth mentioning that for these services, I cannot shift to Data contracts...</p>
  
  <p>One of my types specifies a property whose type happens to be an enum:</p>
  
  <pre><code>[SerializableAttribute()]
  [MessageContract(IsWrapped = false)]
  [KnownType(typeof(RiskTypeCode))]
  public partial class RiskType : Lookup
  {
  
      private RiskTypeCode codeField;
  
      /// &lt;remarks/&gt;
      [XmlElement(ElementName="code")]
      [MessageBodyMember]
      public RiskTypeCode Code
      {
          get
          {
              return this.codeField;
          }
          set
          {
              this.codeField = value;
          }
      }
  </code></pre>
  
  <p>e.t.c.</p>
  
  <p>My enum is defined as:</p>
  
  <pre><code>[Serializable()]
  [DataContract]
  public enum RiskTypeCode
  {
  
      /// &lt;remarks/&gt;
      [XmlEnumAttribute(Name = "THING1")]
      [EnumMember]
      THING1,
  
      /// &lt;remarks/&gt;
      [XmlEnumAttribute(Name="THING2")]
      [EnumMember]
      THING2,
  
      /// &lt;remarks/&gt;
      [XmlEnumAttribute(Name="THING3")]
      [EnumMember]
      THING3,
  }
  </code></pre>
  
  <p>But when I send this across the wire, the RiskTypeCode property is not serialised - i.e. it's ommitted from the output.</p>
  
  <p>What do I need to decorate my enum/property with to get it across the wire?</p>