title: Enum not getting serialized in WCF
body: <p>I'm having a problem with an enum getting serialized in my WCF application.</p>
  
  <p>I have a class <code>Account</code> which inherits from an interface <code>IAccount</code> defined as follows:</p>
  
  <pre><code>namespace MyNamespace
  {
     public interface IAccount
     {
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public string EmailAddress { get; set; }
        public Country Country { get; set; }
     }
  }
  </code></pre>
  
  <p>The <code>Account</code> class which inherits from <code>IAccount</code> is defined as:</p>
  
  <pre><code>namespace MyNamespace
  {
     [DataContract]
     public Account : IAccount
     {
      [DataMember]          
      public string FirstName { get; set; }
  
      [DataMember] 
      public string LastName { get; set; }
  
      [DataMember] 
      public string EmailAddress { get; set; }
  
      [DataMember] 
      public Country Country { get; set; }
     }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>The Country <code>Enum</code> is as follows:</p>
  
  <pre><code>namespace MyNamespace
  {
    public enum Country
    {
      America = 1,
      England = 2,
      France = 3
    }
  </code></pre>
  
  <p>}</p>
  
  <p>Creating an <code>Account</code> object on the client side and calling the method AddAccount decorated with the <code>OperationContract</code> serializes the Account object as:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
      &lt;soap:Body&gt;
          &lt;AddAccount xmlns="http://tempuri.org/"&gt;
              &lt;account&gt;
                  &lt;FirstName xmlns="http://schemas.datacontract.org/2004/07/MyNamespace"&gt;MyFirstName&lt;/FirstName&gt;
                  &lt;LastName xmlns="http://schemas.datacontract.org/2004/07/MyNamespace"&gt;MyLastName&lt;/LastName&gt;
                  &lt;EmailAddress xmlns="http://schemas.datacontract.org/2004/07/MyNamespace"&gt;MyEmail@gmail.com&lt;/EmailAddress&gt;
              &lt;/account&gt;
          &lt;/AddAccount&gt;
      &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
  </code></pre>
  
  <p>You will notice that the <code>Country</code> enum is not getting serialized. </p>
  
  <p>I've tried everything from decorating the enum with DataContract and EnumMember and even explicitly setting the namespace in the attribute values for the DataContracts to even setting Values for the EnumMember attributes but nothing seems to work.</p>
  
  <p>I don't know whether i'm going nuts and missing out something really obvious or is there something else that I would need to do that's not part of the code above.</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>Looking at the proxy class that was generated on the client side after adding the WCF application as a web reference I noticed that the enum is not decorated with <code>[System.Xml.Serialization.XmlElementAttribute(IsNullable = true)]</code> like the other properties.</p>