title: Returning Descendants of a xml node as a List<string> using LINQ or XPATH
body: <p>I have a xml file like this</p>
  
  <pre><code>&lt;Document&gt;
     &lt;Tests&gt;
         &lt;Test&gt;
            &lt;Name&gt;A&lt;/Name&gt;
            &lt;Type&gt;Like A&lt;/Type&gt;
            &lt;Members&gt;
                 &lt;Member&gt;1&lt;/Member&gt;
                 &lt;Member&gt;2&lt;/Member&gt;
                 &lt;Member&gt;3&lt;/Member&gt;
            &lt;/Members&gt;
         &lt;/Test&gt;
         &lt;Test&gt;
            &lt;Name&gt;B&lt;/Name&gt;
            &lt;Type&gt;Like B&lt;/Type&gt;
            &lt;Members&gt;
                 &lt;Member&gt;4&lt;/Member&gt;
                 &lt;Member&gt;5&lt;/Member&gt;
                 &lt;Member&gt;6&lt;/Member&gt;
            &lt;/Members&gt;
         &lt;/Test&gt;
      &lt;/Tests&gt;
  &lt;/Document&gt;
  </code></pre>
  
  <p>Now I made a class to hold data for each Test nodes:</p>
  
  <pre><code>public class TestData
  {
  public string Name {get;set;}
  public string Type {get;set;}
  
  public List&lt;string&gt; Members = new List&lt;string&gt;();
  
  public AddMembers(List&lt;string&gt; members)
  {
  Members.AddRange(members);
  }
  }
  </code></pre>
  
  <p>Now I am trying to use xpath to fill my TestData class, but I have problem adding members to the List I have. I am trying to use LINQ but I cant do it yet :(</p>
  
  <pre><code>   public List&lt;TestClass&gt; GetTests()
      {
          List&lt;TestClass&gt; tests = new List&lt;TestClass&gt;();
          TestClass test;
  
          XPathNodeIterator it = nav.Select("/Document/Tests/Test");
  
          foreach (XPathNavigator val in it)
          {
              test= new TestClass();
              test.Name = val.SelectSingleNode(nav.Compile("Name")).Value;
              test.Type = val.SelectSingleNode(nav.Compile("Type")).Value;
              test.AddMembers(); //How can I return all the member nodes in a list?
  
              tests.Add(test);
          }
  
  
          return tests ;
      }
  </code></pre>