title: Best LINQ-to-XML query to select nodes based on properties of descendant nodes?
body: <p>I have the following XML document:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;FamilyTree&gt;
    &lt;Parent name="Ken"&gt;
      &lt;Child name="Lorna"&gt;
        &lt;Grandchild name="Andrew"/&gt;
        &lt;Grandchild name="Brian"/&gt;
      &lt;/Child&gt;
      &lt;Child name="Mike"&gt;
        &lt;Grandchild name="Ann"/&gt;
        &lt;Grandchild name="Beth"/&gt;
      &lt;/Child&gt;
    &lt;/Parent&gt;
    &lt;Parent name="Norma"&gt;
      &lt;Child name="Owen"&gt;
        &lt;Grandchild name="Charles"/&gt;
      &lt;/Child&gt;
      &lt;Child name="Peter"&gt;
        &lt;Grandchild name="Charlotte"/&gt;
      &lt;/Child&gt;
    &lt;/Parent&gt;
    &lt;Parent name="Quinn"&gt;
      &lt;Child name="Robert"&gt;
        &lt;Grandchild name="Debbie"/&gt;
        &lt;Grandchild name="Eric"/&gt;
      &lt;/Child&gt;
      &lt;Child name="Susan"&gt;
        &lt;Grandchild name="Frank"/&gt;
      &lt;/Child&gt;
    &lt;/Parent&gt;
    &lt;Parent name="Tom"&gt;
      &lt;Child name="Ursula"&gt;
        &lt;Grandchild name="George"/&gt;
        &lt;Grandchild name="Harriet"/&gt;
      &lt;/Child&gt;
      &lt;Child name="Victor"&gt;
        &lt;Grandchild name="Ian"/&gt;
        &lt;Grandchild name="Juliet"/&gt;
      &lt;/Child&gt;
    &lt;/Parent&gt;
  &lt;/FamilyTree&gt;
  </code></pre>
  
  <p>I'm trying to select all the "Parents" with a Child who has at least two children ("Grandchild") of his/her own. Note that I'm <em>not</em> looking for "Parents" with at least two "Grandchild[ren]".</p>
  
  <p>The following LINQ query works, but I've a feeling it's not the most elegant. </p>
  
  <pre><code>IEnumerable&lt;XElement&gt; parents = (from c in familyTreeElement.Descendants("Child")
                                   where c.Elements().Count() &gt; 1
                                   select c.Parent).Distinct();
  </code></pre>
  
  <p>Is there a better way to specify this?</p>