title: How to deserialize nested XML?
body: <p>I'm new into this, and I've been searching around similar questions and that's all I got for now. I want to keep XML hierarchy and make it a something that could be iterated.</p>
  
  <pre><code>static void Main(string[] args)
          {
              List&lt;Movie&gt; movies = DeserializeFromXML();
              for (int i = 0; i &lt; movies.Count; i++)
              {
                  Console.WriteLine(movies[i]);
              }
          }
  </code></pre>
  
  <p>.</p>
  
  <pre><code>static List&lt;Movie&gt; DeserializeFromXML()
          {
              XmlSerializer deserializer = new XmlSerializer(typeof(List&lt;Movie&gt;));
              TextReader textReader = new StreamReader(@"C:\movies.xml");
  
              List&lt;Movie&gt; movies;
              movies = (List&lt;Movie&gt;)deserializer.Deserialize(textReader);
              textReader.Close();
  
              return movies;
          }
  </code></pre>
  
  <p>.</p>
  
  <pre><code>public class Movie
  {
    public string Name
    { get; set; }
  }
  </code></pre>
  
  <p>.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;Favorites&gt;
    &lt;User&gt;
      &lt;Name&gt;User 1 Name&lt;/Name&gt;
      &lt;Movie&gt;
        &lt;Name&gt;Movie 1 Name&lt;/Name&gt;
        &lt;Actor&gt;
          &lt;Name&gt;Actor Name&lt;/Name&gt;
        &lt;/Actor&gt;
        &lt;Actor&gt;
          &lt;Name&gt;Actor Name&lt;/Name&gt;
        &lt;/Actor&gt;
      &lt;/Movie&gt;
      &lt;Movie&gt;
        &lt;Name&gt;Movie 2 Name&lt;/Name&gt;
        &lt;Actor&gt;
          &lt;Name&gt;Actor Name&lt;/Name&gt;
        &lt;/Actor&gt;
      &lt;/Movie&gt;
    &lt;/User&gt;
      &lt;User&gt;
      &lt;Name&gt;User 2 Name&lt;/Name&gt;
      &lt;Movie&gt;
        &lt;Name&gt;Movie 1 Name&lt;/Name&gt;
        &lt;Actor&gt;
          &lt;Name&gt;Actor Name&lt;/Name&gt;
        &lt;/Actor&gt;
        &lt;Actor&gt;
          &lt;Name&gt;Actor Name&lt;/Name&gt;
        &lt;/Actor&gt;
      &lt;/Movie&gt;
      &lt;Movie&gt;
        &lt;Name&gt;Movie 2 Name&lt;/Name&gt;
        &lt;Actor&gt;
          &lt;Name&gt;Actor Name&lt;/Name&gt;
        &lt;/Actor&gt;
      &lt;/Movie&gt;
    &lt;/User&gt;
  &lt;/Favorites&gt;
  </code></pre>
  
  <p>My XML looks like that. This works and I can actually read the first level, but cant reach the lower levels yet.</p>