title: If statement selecting only first value in linq2xml query
body: <p>I have an XML file that's being read. I'm trying to check if Product.Id is in the XML file. The problem: it only reads the first XML Product values.</p>
  <p>I have the following if-statement:</p>
  <pre><code>    if ((int)user.ElementAt(0).Element(&quot;Product&quot;).Element(&quot;Id&quot;) == product.Id)
      {
         // Do some logic
      }
  </code></pre>
  <p>User select looks like this:</p>
  <pre><code>    var user = from item in doc.Descendants(&quot;User&quot;)
                 where (string)item.Element(&quot;Username&quot;) == username
                 select item.Element(&quot;UserProducts&quot;);
  </code></pre>
  <p>The select results in this XML:</p>
  <pre><code>&lt;UserProducts&gt;
    &lt;Product&gt;
      &lt;Id&gt;1&lt;/Id&gt;
      &lt;Name&gt;Mouse&lt;/Name&gt;
      &lt;Amount&gt;2&lt;/Amount&gt;
    &lt;/Product&gt;
    &lt;Product&gt;
      &lt;Id&gt;2&lt;/Id&gt;
      &lt;Name&gt;Keyboard&lt;/Name&gt;
      &lt;Amount&gt;1&lt;/Amount&gt;
    &lt;/Product&gt;
  &lt;/UserProducts&gt;
  </code></pre>
  <p>The if statement only checks the first Product entry (ID 1, Name Mouse, Amount 2). It does not check the second entry.</p>
  <p>Why does it not check the second entry, and how can I fix it so it checks all entries?</p>
  <p>Expected output:
  An if statement that checks all product entries, and not only the first entry.</p>