title: XmlSerializer Throwing Exception "System.InvalidOperationException"
body: <p>I' trying to set list data into xml format. I have a complex objects</p>
  
  <p>class user Info that is contain a list of another class object</p>
  
  <pre><code>[Serializable]
  class UserInfo : Address
  {
      [XmlElement("Firstname")]
      public  String firstname { get; set; }
      [XmlElement("Surname")]
      public String surname { get; set; }
      [XmlArray("Addresses")]
     // [XmlArrayItem("Address",typeof(Address))]
      public List&lt;Address&gt; addressesL { get; set;}
  }
  </code></pre>
  
  <p>Address class has only one field of string </p>
  
  <pre><code>  class Address
  {
  
  [XmlElement("Address")]
     public String saddress { get; set; }
  }
  </code></pre>
  
  <p>here is the main </p>
  
  <pre><code>static void Main(string[] args)
      {
  
  
  
          UserInfo user = new UserInfo();
          Address adres = new Address();
          List&lt;Address&gt; adresl = new List&lt;Address&gt;();
          List&lt;UserInfo&gt; userlist = new List&lt;UserInfo&gt;();
          user.firstname = "Mustafa";
          user.surname = "Alqanbar";
  
          adres.saddress = "Saudi Arabia";
          adresl.Add(adres);
  
          adres = new Address();
          adres.saddress = "Australia";
          adresl.Add(adres);
  
          user.addressesL = adresl;
  
  
          userlist.Add(user);
  
          for (int i = 0; i &lt; userlist.Count; i++)
          {
              Console.Write("{0} {1}  ",userlist[i].firstname, userlist[i].surname);
              for (int j = 0; j &lt; userlist[i].addressesL.Count; j++) 
              {
                  Console.Write("{0} ",userlist[i].addressesL[j].saddress);
              }
              Console.WriteLine();
          }
          XmlSerializer ser = new XmlSerializer((typeof(List&lt;UserInfo&gt;)));
         // XmlSerializer deser = XmlSerializer.FromTypes(new[] { (typeof(List&lt;UserInfo&gt;)) })[0];
  
  
              using (TextWriter writer = new StreamWriter(@"c:\x.xml"))
              {
                  ser.Serialize(writer, user);
              }
  
  
              Console.ReadKey();
      }
  </code></pre>
  
  <p>I read some posts in stack overflow, but I couldn't sort my problem out.</p>