title: c# linq to xml to list
body: <p>I was wondering if there is a way to get a list of results into a list with linq to xml. If I would have the following xml for example:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;Sports xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
      &lt;SportPages&gt;
          &lt;SportPage type="test"&gt;
              &lt;LinkPage&gt;
                  &lt;IDList&gt;
                      &lt;string&gt;1&lt;/string&gt;
                      &lt;string&gt;2&lt;/string&gt;
                  &lt;/IDList&gt;
              &lt;/LinkPage&gt;
          &lt;/SportPage&gt;
      &lt;/SportPages&gt;
  &lt;/Sports&gt;
  </code></pre>
  
  <p>How could I get a list of strings from the IDList?</p>
  
  <p>I'm fairly new to linq to xml so I just tried some stuff out, I'm currently at this point:</p>
  
  <pre><code>var IDs = from sportpage in xDoc.Descendants("SportPages").Descendants("SportPage")
                        where sportpage.Attribute("type").Value == "Karate"
                        select new
                        {
                            ID = sportpage.Element("LinkPage").Element("IDList").Elements("string")
                        };
  </code></pre>
  
  <p>But the var is to chaotic to read decently. Isn't there a way I could just get a list of strings from this?</p>
  
  <p>Thanks</p>