title: XmlSerializer throwing exception with generic list during serialization
body: <p>I'm attempting to serialize (and subsequently deserialize) a rather simple class to an XML string, but am getting an exception: "The type System.Collections.Generic.List`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] may not be used in this context."</p>
  
  <p>The method I'm using to serialize is:</p>
  
  <pre><code>public string ToXml(TaskListFilterConfig config)
  {
      Type[] extraTypes = { typeof(FilterConfig), typeof(SortConfig) };
  
      XmlSerializer serializer = new XmlSerializer(config.GetType(), extraTypes);
  
      using (StringWriter writer = new StringWriter())
      {
          serializer.Serialize(writer, config);
  
          return writer.ToString();
      }
  }
  </code></pre>
  
  <p>The classes I'm attempting to serialize are:</p>
  
  <pre><code>[XmlRoot(ElementName = "TaskListFilterConfig", IsNullable = false)]
  [XmlInclude(typeof(FilterConfig))]
  [XmlInclude(typeof(SortConfig))]
  public class TaskListFilterConfig
  {
      [XmlArray("FilterConfigList")]
      [XmlArrayItem("FilterConfig")]
      public List&lt;FilterConfig&gt; FilterConfigList { get; set; }
  
      [XmlArray("SortConfigList")]
      [XmlArrayItem("SortConfig")]
      public List&lt;SortConfig&gt; SortConfigList { get; set; }
  
      public TaskListFilterConfig() 
      {
          FilterConfigList = new List&lt;FilterConfig&gt;();
          SortConfigList = new List&lt;SortConfig&gt;();
      }
  }
  
  
  [XmlType("FilterConfig")]
  public class FilterConfig
  {
  
      public OperandType Operand { get; set; }
  
      public int SelectedOperatorIndex { get; set; }
  
      public int SelectedColumnIndex { get; set; }
  
      public object RightOperand { get; set; }
  
      public FilterConfig() { }
  }
  
  [XmlType("SortConfig")]
  public class SortConfig
  {
      public Infragistics.Windows.Controls.SortStatus SortDirection { get; set; }
  
      public int ColumnSelectedIndex { get; set; }
  
      public SortConfig() { }
  }
  </code></pre>