Created
December 27, 2012 16:10
-
-
Save anonymous/4389415 to your computer and use it in GitHub Desktop.
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; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment