public static IEnumerable <TResult> Ancestors <TResult>(this IEnumerable <TResult> startNodes, Func <TResult, TResult> parentSelector, bool includeSelf = false) { return(startNodes.SelectMany(startNode => HierarchyWalker.Ancestors(startNode, parentSelector, includeSelf))); }
public static IEnumerable <TResult> Descendants <TResult>(this IEnumerable <TResult> startNodes, Func <TResult, IEnumerable <TResult> > childSelector, bool includeSelf = false) { return(startNodes.SelectMany(startNode => HierarchyWalker.Descendants(startNode, childSelector, includeSelf))); }