title: c# inheriting generic collection and serialization
body: <p>The setup:</p>
  
  <pre><code>class Item
  {
      private int _value;
  
      public Item()
      {
          _value = 0;
      }
  
      public int Value { get { return _value; } set { _value = value; } }
  }
  
  class ItemCollection : Collection&lt;Item&gt;
  {
      private string _name;
  
      public ItemCollection()
      {
          _name = string.Empty;
      }
  
      public string Name { get {return _name;} set {_name = value;} }
  }
  </code></pre>
  
  <p>Now, trying to serialize using the following code fragment:</p>
  
  <pre><code>ItemCollection items = new ItemCollection();
  
  ...
  
  XmlSerializer serializer = new XmlSerializer(typeof(ItemCollection));
  using (FileStream f = File.Create(fileName))
      serializer.Serialize(f, items);
  </code></pre>
  
  <p>Upon looking at the resulting XML I see that the ItemCollection.Name value is not there!</p>
  
  <p>I think what may be happening is that the serializer sees the ItemCollection type as a simple Collection thus ignoring any other added properties...</p>
  
  <p>Is there anyone having encountered such a problem and found a solution?</p>
  
  <p>Regards,</p>
  
  <p>Stécy</p>