title: Get XElements List of XElements List from XML document using linq to xml
body: <p>I create a list of node object:</p>
  
  <pre><code>public class Node
  {
      public string Key { get; set; }
      public string Value { get; set; }
  }
  
  public class ListNode : List&lt;Node&gt; {  }
  </code></pre>
  
  <p>And i have an xml document :</p>
  
  <pre><code>&lt;details&gt;
  &lt;detail&gt;
    &lt;node&gt;
      &lt;key&gt;xxx&lt;/key&gt;
      &lt;value&gt;111&lt;/value&gt;
    &lt;/node&gt;
    &lt;node&gt;
      &lt;key&gt;yyy&lt;/key&gt;
      &lt;value&gt;222&lt;/value&gt;
    &lt;/node&gt;
  &lt;/detail&gt;
  &lt;detail&gt;
    &lt;node&gt;
      &lt;key&gt;zzz&lt;/key&gt;
      &lt;value&gt;333&lt;/value&gt;
    &lt;/node&gt;
    &lt;node&gt;
      &lt;key&gt;aaa&lt;/key&gt;
      &lt;value&gt;444&lt;/value&gt;
    &lt;/node&gt;
  &lt;/detail&gt;
  &lt;/details&gt;
  </code></pre>
  
  <p>what i want to do is to put these xml elements to a List of ListNode objects using linq to xml: </p>
  
  <pre><code>&lt;node&gt; =&gt; Node Object
  &lt;detail&gt; =&gt; ListNode
  &lt;details&gt; =&gt; List&lt;ListNode&gt;
  </code></pre>
  
  <p>this is my linq to xml request:</p>
  
  <pre><code>List&lt;ListNode&gt; listNodeDetails = xElement
      .Element("details")
      .Elements("detail")
      .Elements("node")
      .Select(n =&gt; new Node() 
          { Key = n.Element("key").Value, 
            Value = n.Element("node").Element("value").Value 
          })
      .ToList();
  </code></pre>