title: TO get the Distinct decendant nodes by filtering the attribute value of the node
body: <pre><code>&lt;states_Page&gt;
    &lt;states&gt;
    &lt;state id="sectionenable" systemstate="n" focuscontrol="" default=""&gt;
    &lt;/state&gt;
  &lt;/states&gt;
  &lt;states&gt;
    &lt;state id="controlenable" systemstate="n" focuscontrol="" default=""&gt;
    &lt;/state&gt;
  &lt;/states&gt;
  &lt;states&gt;
    &lt;state id="controldisable" systemstate="n" focuscontrol="" default=""&gt;
    &lt;/state&gt;
  &lt;/states&gt;
  &lt;states&gt;
    &lt;state id="controldisable2" systemstate="n" focuscontrol="" default=""&gt;
    &lt;/state&gt;
  &lt;/states&gt;
  &lt;states&gt;
    &lt;state id="sectionenable2" systemstate="n" focuscontrol="" default=""&gt;
    &lt;/state&gt;
  &lt;/states&gt;
  &lt;states&gt;
    &lt;state id="sectionenable" systemstate="n" focuscontrol="" default=""&gt;
    &lt;/state&gt;
  &lt;/states&gt;
  &lt;/states_Page&gt;
  </code></pre>
  
  <p>there are 6 elements under the root element..</p>
  
  <p>i want the nodes which having a distinct Attribute name.</p>
  
  <p>so i need to return only 5 elements those having a distinct attribute values.
  i have tried a  linq but it returns the distinct attribute value alone..but i need the whole Element.</p>
  
  <pre><code>var ds = (from ele in root.Elements("states").Elements("state") 
            select ele.Attribute("id").Value).Distinct();
  </code></pre>
  
  <p>so help me to get the whole element in a <strong>single line of query.</strong></p>