title: Select attributes value in XML file using C# and LINQ to XML
body: <p>In this <code>XML</code> file, i would like to get all the <em>IDs</em> written in the <code>ID</code> attributes</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;root&gt;
    &lt;head&gt;
      &lt;datemaj&gt;20140206-15-04-00&lt;/datemaj&gt;
    &lt;/head&gt;
    &lt;PressReleases&gt;
      &lt;PressRelease id="545" version="1"&gt;
        &lt;Name&gt;Convert number to string&lt;/Name&gt;
        &lt;Date&gt;20/05/1985&lt;/Date&gt;
        &lt;Input&gt;1&lt;/Input&gt;
        &lt;Output&gt;One&lt;/Output&gt;
      &lt;/PressRelease&gt;
      &lt;PressRelease id="544" version="1"&gt;
        &lt;Name&gt;Find succeeding characters&lt;/Name&gt;
        &lt;Date&gt;19/05/1985&lt;/Date&gt;
        &lt;Input&gt;abc&lt;/Input&gt;
        &lt;Output&gt;def&lt;/Output&gt;
      &lt;/PressRelease&gt;
      &lt;PressRelease id="543" version="1"&gt;
        &lt;Name&gt;Convert multiple numbers to strings&lt;/Name&gt;
        &lt;Date&gt;17/05/1985&lt;/Date&gt;
        &lt;Input&gt;123&lt;/Input&gt;
        &lt;Output&gt;One Two Three&lt;/Output&gt;
      &lt;/PressRelease&gt;
      &lt;PressRelease id="542" version="1"&gt;
        &lt;Name&gt;Find correlated key&lt;/Name&gt;
        &lt;Date&gt;02/05/1985&lt;/Date&gt;
        &lt;Input&gt;a1&lt;/Input&gt;
        &lt;Output&gt;b1&lt;/Output&gt;
      &lt;/PressRelease&gt;
      &lt;PressRelease id="541" version="1"&gt;
        &lt;Name&gt;Count characters&lt;/Name&gt;
        &lt;Date&gt;04/02/1985&lt;/Date&gt;
        &lt;Input&gt;This is a test&lt;/Input&gt;
        &lt;Output&gt;14&lt;/Output&gt;
      &lt;/PressRelease&gt;
      &lt;PressRelease id="540" version="1"&gt;
        &lt;Name&gt;Another Test&lt;/Name&gt;
        &lt;Date&gt;09/01/1985&lt;/Date&gt;
        &lt;Input&gt;Test Input&lt;/Input&gt;
        &lt;Output&gt;10&lt;/Output&gt;
      &lt;/PressRelease&gt;
    &lt;/PressReleases&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>I tried this block of code , but <strong>it returns nothing</strong>:</p>
  
  <pre><code>        XDocument xdoc = XDocument.Load(@"C:\Users\ARNAUD\Documents\local\temp.xml");
          List&lt;int&gt; IDsInDistantXML = xdoc.Root.Elements("PressRelease")
                              .Select(pr =&gt; (int)pr.Attribute("id"))
                              .ToList();
  </code></pre>
  
  <p>PS: the <code>XML</code> file is correctly found.</p>