title: Unable to deserialize when inheriting from IList<T> or IEnumerable<T>
body: <p>I've got the following class which is used to deserialize an XML feed....</p>
  
  <pre><code>[Serializable]
  [XmlRoot("forecast")]
  public class ForecastCollection : IList&lt;Weather&gt;
  {
      private List&lt;Weather&gt; _List = new List&lt;Weather&gt;();
  
      #region Implementation of IList&lt;T&gt;
  
      public IEnumerator&lt;Weather&gt; GetEnumerator()
      {
          return _List.GetEnumerator();
      }
  
      IEnumerator IEnumerable.GetEnumerator()
      {
          return GetEnumerator();
      }
  
      public void Add(Weather item)
      {
          _List.Add(item);
      }
  
      public void Clear()
      {
          _List.Clear();
      }
  
      public bool Contains(Weather item)
      {
          return _List.Contains(item);
      }
  
      public void CopyTo(Weather[] array, int arrayIndex)
      {
          _List.CopyTo(array, arrayIndex);
      }
  
      public bool Remove(Weather item)
      {
          return _List.Remove(item);
      }
  
      [XmlIgnore]
      public int Count
      {
          get { return _List.Count; }
      }
  
      public bool IsReadOnly
      {
          get { throw new NotImplementedException(); }
      }
  
      public int IndexOf(Weather item)
      {
          return _List.IndexOf(item);
      }
  
      public void Insert(int index, Weather item)
      {
          _List.Insert(index, item);
      }
  
      public void RemoveAt(int index)
      {
          _List.RemoveAt(index);
      }
  
      [XmlIgnore]
      public Weather this[int index]
      {
          get { return _List[index]; }
          set { _List[index] = value; }
      }
  
      #endregion
  
      public Weather Today
      {
          get
          {
              if (Count &gt; 0)
              {
                  return this[0];
              }
  
              throw new IndexOutOfRangeException("Could not retrieve todays weather from forecast");
          }
      }
  
      [XmlArray("simpleforecast")]
      [XmlArrayItem("forecastday")]
      public List&lt;Weather&gt; Forecast
      {
          get { return _List; }
          set { _List = value; }
      }
  }
  </code></pre>
  
  <p>When I deserialize the feed, it doesn't seem to set the Forecast property so when I access Today, the exception is thrown. However, if I remove the inheritance from this class, it deserializes correctly. </p>
  
  <p>EDIT: So to reiterate, it appears as though it only deserializes correctly when ForecastCollection doesn't inherit from something which implements IEnumerable</p>
  
  <p>Can anyone point out where I've gone wrong and the best way to fix this?</p>
  
  <p>Thanks</p>