title: C# XmlSerializer fails on deserialization of an empty enum list if it's in an xmlattribute
body: <p>This is a note to my future self, and for the benefit of others.
  The described behavoir is NOT obvious...</p>
  
  <p>I've got this bit of C#:</p>
  
  <pre><code>public enum Choices 
  {
    One,
    Two,
    Three,
  }
  
  public class Element 
  {
    List&lt;Choices&gt; _allowedChoices;
    [XmlAttribute]
    public List&lt;Choices&gt; AllowedChoices
    {
      get {return _allowedChoices ?? ( _allowedChoices = new List&lt;Choices&gt;() );}
      set { _allowedChoices = value; }
    }
  }
  
  [Test]
  public void testing_empty_enum_list_serialization()
  {
      var ser = new XmlSerializer(typeof (Element));
      using (var sw = new StringWriter())
      {
          ser.Serialize(sw, new Element
          {
              AllowedChoices = {},
          });
          var text = sw.ToString();
          Console.WriteLine(text);
          using (var sr = new StringReader(text))
          {
              var deserialized  = (Element) ser.Deserialize(sr);
          }
      }
  }
  </code></pre>
  
  <p>If I use the XmlSerializer to serialize this to xml I get:</p>
  
  <p>( Note the empty AllowedChoices attribute at the end )</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-16"?&gt;
  &lt;Element xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" AllowedChoices="" /&gt;
  </code></pre>
  
  <p>If I then use the XmlSerializer to deserialize this xml I something like:</p>
  
  <pre><code>System.InvalidOperationException : There is an error in XML document (2, 109).
    ----&gt; System.InvalidOperationException : Instance validation error: '' is not a valid value for Choices.
  </code></pre>
  
  <p>This is an empty <em>list</em> of enums that serializes without error, Y U NO deserialize!? </p>