Revision: 28746
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 13, 2010 21:55 by leetreveil
Initial Code
/// <summary> /// Flattens any tree into an enumeration /// </summary> /// <typeparam name="T"></typeparam> /// <param name="item"></param> /// <param name="next"></param> /// <returns></returns> public static IEnumerable<T> Flatten<T>(T item, Func<T, IEnumerable<T>> next) { yield return item; foreach (T child in next(item)) foreach (T flattenedChild in Flatten(child, next)) yield return flattenedChild; }
Initial URL
Initial Description
Initial Title
Flatten a tree into an enumeration
Initial Tags
Initial Language
C#