Hmmm ... I find it difficult to understand what exactly :)
Usually, to find out if there are any elements, I would use Any
- but you want to see if there are at least two elements. We still do not need to use Count
, although - because there are at least two elements - this is the same as skipping the element and see if there are any more. So that...
var parents = familyTreeElement.Elements("Parent") .Where(parent => parent.Elements("Child").Any( child => child.Elements("Grandchild").Skip(1).Any()));
I think it works - and in fact it is not too poorly read:
For each parent, see if any of the children have any (great) children after ignoring the first (big) child.
I suspect using XPath (according to Marc's answer) would be the most readable option.
source share