Skip to content

Instantly share code, notes, and snippets.

View jaypeeZero's full-sized avatar

James Wright jaypeeZero

  • St. Louis
  • 19:16 (UTC -05:00)
View GitHub Profile
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;
}
}
}