title: deserialize XML to List of objects
body: <p>I have a List that I populate with ToDo objects and save to XML. This works perfectly. I have problems with deserializing XML back to the List of ToDo objects. I know that there is already few simillar questions but none of them helped me, therefore, I'm writing.</p>
  
  <p>ToDo object class:</p>
  
  <pre><code>public class ToDo
  {
      public string ToDoString;
      public DateTime Date;
  }
  </code></pre>
  
  <p>Main program class and methods to serialize and deserialize:</p>
  
  <pre><code> static class Program
  {
      static List&lt;ToDo&gt; ToDoList = new List&lt;ToDo&gt;();
  
      public static void Serialize(string toDoString)
      {
          // Create and Initialise the object
          ToDo newToDo = new ToDo();
          newToDo.ToDoString = toDoString;
          newToDo.Date = DateTime.Now;
  
          // Add the object to the List
          ToDoList.Add(newToDo);
  
          // Serialize List and save to XML
          XmlSerializer mySerializer = new XmlSerializer(ToDoList.GetType());
          // To write to a file, create a StreamWriter object.
          StreamWriter myWriter = new StreamWriter("myXML.xml");
          mySerializer.Serialize(myWriter, ToDoList);
          myWriter.Close();
      }
  
      public static void Deserialize()
      {
          // This code was originally wrote to deserialize single object. Now I need to deserialize List of objects and this code doesn't work.
          XmlSerializer myDeserializer = new XmlSerializer(ToDoList.GetType());
          FileStream myFileStream = new FileStream("myXML.xml", FileMode.Open);
          deserializeToDo = (ToDo) // Problems start here
          myDeserializer.Deserialize(myFileStream);
          myFileStream.Close();
      }
  }
  </code></pre>
  
  <p>So how do I deserialize XML to List of ToDo objects?</p>
  
  <p>Many thanks for help.</p>