title: C# Linq to XML query
body: <pre><code>&lt;World&gt;
    &lt;Animals&gt;
      &lt;Tab&gt;
        &lt;Dogs id ="1"&gt;
          &lt;Dog1&gt;&lt;/Dog1&gt;
          &lt;Dog2&gt;&lt;/Dog2&gt;
          &lt;Dog3&gt;&lt;/Dog3&gt;
        &lt;/Dogs&gt;
        &lt;Dogs id ="2"&gt;&lt;/Dogs&gt;
        &lt;Dogs id ="3"&gt;&lt;/Dogs&gt;
      &lt;/Tab&gt;
    &lt;/Animals&gt;
  &lt;/World&gt;
  </code></pre>
  
  <p>How do I get all elements under  tag where id == 1?</p>
  
  <p>My Linq query. (doesn't work) why?</p>
  
  <pre><code>XDocument xml= XDocument.Load(xml.xml);
  var elements = from e in xml.Descendants("Animals").Descendants("Tab").Elements("Dogs")
  where e.Attribute("id").toString().Equals("1")
  select c;
  </code></pre>
  
  <p>Could you check it please? </p>
  
  <p>Thanks!</p>