This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static IEnumerable<T> Descendants<T>(this IEnumerable<T> source, Func<T, IEnumerable<T>> DescendBy) { | |
foreach (T value in source) { | |
yield return value; | |
foreach (T child in DescendBy(value).Descendants<T>(DescendBy)) { | |
yield return child; | |
} | |
} | |
} | |