/// <summary> /// Returns a collection containing this element and all ancestor elements. /// </summary> public static IEnumerable <ITreeNode <TNode> > SelfAndAncestors <TNode>(this ITreeNode <TNode> adapter) { yield return(adapter); foreach (var child in adapter.Ancestors()) { yield return(child); } }