title: How to serialize a XML node of repeated elements
body: <p>I am trying to deserialize some XML into an array of items.</p>
  
  <p>Here's the XML:</p>
  
  <pre><code>&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;
  &lt;items&gt;
      &lt;item&gt;
          &lt;name&gt;John&lt;/name&gt;
      &lt;/item&gt;
      &lt;item&gt;
           &lt;name&gt;Jane&lt;/name&gt;
      &lt;/item&gt;
  &lt;/items&gt;
  </code></pre>
  
  <p>And my class:</p>
  
  <pre><code>[XmlRoot("item")]
  public class Item
  {
      [XmlElement("name")]
      public string Name { get; set; }
  }
  </code></pre>
  
  <p>I then deserialize:</p>
  
  <pre><code>var xmlSerializer = new XmlSerializer(typeof(Item[]), new XmlRootAttribute("items"));
  using (TextReader textReader = new StringReader(xmlString))
  {
      var items = (Item[])xmlSerializer.Deserialize(textReader);
      var itemCount = items.Length;
  }
  </code></pre>
  
  <p>itemCount is 0 (it should be 2).</p>
  
  <p>There is a similar solution here: <a href="https://stackoverflow.com/questions/15544517/xmlrootattribute-placement-when-deserializing-to-list">https://stackoverflow.com/questions/15544517</a> but it seem to work only when the XML node names are identical to the class names (mine differ in capitalisation).</p>
  
  <p>What do I need to modify to ensure all the items deserialize?</p>