title: When serializing a custom generic collection to Xml how do I add an attribute to the generated collection element
body: <p>When serializing a custom generic collection to Xml how do I add an attribute to the generated collection element. </p>
  
  <p>Currently I have:</p>
  
  <pre><code>&lt;RootObject&gt;
    &lt;Id&gt;1&lt;/Id&gt;
    &lt;Items&gt;
      &lt;MyCollectionItem/&gt;
      &lt;MyCollectionItem/&gt;
    &lt;/Items&gt;
  &lt;/RootObject&gt;
  </code></pre>
  
  <p>What I need is:</p>
  
  <pre><code>&lt;RootObject&gt;
    &lt;Id&gt;1&lt;/Id&gt;
    &lt;Items Name="My collection name"&gt;
      &lt;MyCollectionItem/&gt;
      &lt;MyCollectionItem/&gt;
    &lt;/Items&gt;
  &lt;/RootObject&gt;
  </code></pre>
  
  <p>My code looks like this:</p>
  
  <pre><code>public class RootObject
  {
      [XmlArray()]
      public MyCollection Items;
  
      public string Id;
  }
  
  public class MyCollection : Collection&lt;MyCollectionItem&gt;
  {
      [XmlAttribute()]
      public string Name;
  }
  </code></pre>