title: Deserialize XML with multiple elements into single C# object
body: <p>I need to deserialize an XML document that looks like this:</p>
  
  <pre><code>&lt;Root&gt;
    &lt;Items&gt;
      &lt;Item&gt;
        &lt;ItemHeader Attr1="A" Attr2="B" Attr3="C" /&gt;
        &lt;ItemDetails Attr4="D" Attr5="E" /&gt;
      &lt;/Item&gt;
      ...
    &lt;/Items&gt;
  &lt;/Root&gt;
  </code></pre>
  
  <p>Into a class that looks like this:</p>
  
  <pre><code>[Serializable, XmlRoot("Item")]
  Public class MyItem
  {
    [XmlAttribute("Attr1")]
    public string Attr1 { get; set; }
    [XmlAttribute("Attr5")]
    public string Attr5 { get; set; }
  }
  </code></pre>
  
  <p>And I am using the following code to perform the deserialization:</p>
  
  <pre><code>XDocument doc;
  XElement rootElem = doc.Element("Root");
  
  foreach (XElement xe in rootElem.Descendants("Item"))
  {
    MyItem item = new MyItem();
    XmlSerializer xmlSerializer = new XmlSerializer(typeof(MyItem));
    XmlReader xRdr = xe.CreateReader();
    item = (MyItem)xmlSerializer.Deserialize(xRdr);
  }
  </code></pre>
  
  <p>However, none of the elements are copied into the object instance.  </p>
  
  <p>Is this doable?  Do I need to deserialize each sub Element?</p>
  
  <p>Thanks</p>