title: XmlSerializer.Deserialize() isn't deserializing a List<T> correctly
body: <p>I am new to the C# XmlSerializer so I might be missing something basic here.</p>
  
  <p>The problem I am running into is that I have one class that has a <code>List&lt;T&gt;</code> of another class.  When I serialize the main class the XML looks beautiful and all the data is intact.  When I deserialize the XML, the data in the <code>List&lt;T&gt;</code> disappears and I am left with an empty <code>List&lt;T&gt;</code>.  I am not receiving any errors and the serialization portion works like charm.  </p>
  
  <p>What am I missing with the deserialization process?</p>
  
  <p><strong>EDIT:</strong> Note that the code shown below does not reproduce the problem - it works. This was a simplified version of the real code, which did <em>not</em> work. Unfortunately, the code below was simplified enough to not reproduce the problem!</p>
  
  <pre><code>public class User
  {
    public User()
    {
      this.Characters = new List&lt;Character&gt;();
    }
    public string Username { get; set; }
    public List&lt;Character&gt; Characters { get; set; }
  }
  
  public class Character
  {
    public Character()
    {
      this.Skills = new List&lt;Skill&gt;();
    }
    public string Name { get; set; }
    public List&lt;Skill&gt; Skills { get; set; }
  }
  
  public enum Skill
  {
    TreeClimber,
    ForkliftOperator
  }
  
  public static void Save(User user)
  {
      using (var textWriter = new StreamWriter("data.xml"))
      {
          var xmlSerializer = new XmlSerializer(typeof(User));
          xmlSerializer.Serialize(textWriter, user);
      }
  }
  
  public static User Restore()
  {
      if (!File.Exists("data.xml"))
          throw new FileNotFoundException("data.xml");
  
      using (var textReader = new StreamReader("data.xml"))
      {
          var xmlSerializer = new XmlSerializer(typeof(User));
          return (User)xmlSerializer.Deserialize(textReader);
      }
  }
  
  public void CreateAndSave()
  {
    var character = new Character();
    character.Name = "Tranzor Z";
    character.Skills.Add(Skill.TreeClimber);
  
    var user = new User();
    user.Username = "Somebody";
    user.Characters.Add(character);
  
    Save(user);
  }
  
  public void RestoreAndPrint()
  {
    var user = Restore();
    Console.WriteLine("Username: {0}", user.Username);
    Console.WriteLine("Characters: {0}", user.Characters.Count);
  }
  </code></pre>
  
  <p>The XML generated by executing CreateAndSave() looks like so:</p>
  
  <pre><code>&lt;User&gt;
    &lt;Username&gt;Somebody&lt;/Username&gt;
    &lt;Characters&gt;
      &lt;Character&gt;
        &lt;Name&gt;Tranzor Z&lt;/Name&gt;
        &lt;Skills&gt;
          &lt;Skill&gt;TreeClimber&lt;/Skill&gt;
        &lt;/Skills&gt;
      &lt;/Character&gt;
    &lt;Characters&gt;
  &lt;/User&gt;
  </code></pre>
  
  <p>Perfect!  That's the way it should look.  If I then execute <code>RestoreAndPrint()</code> I get a User object with the Username property set properly but the Characters property is an empty list:</p>
  
  <pre><code>Username: Somebody
  Characters: 0
  </code></pre>
  
  <p>Can anybody explain to me why the Characters property is serialized properly but won't deserialize?</p>