Revision: 67019
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 30, 2014 01:06 by RhinoX64
Initial Code
public static IEnumerable<T> Traverse<T>(this IEnumerable<T> source, Func<T, IEnumerable<T>> fnRecurse) { foreach (T item in source) { yield return item; IEnumerable<T> seqRecurse = fnRecurse(item); if (seqRecurse != null) { foreach (T itemRecurse in Traverse(seqRecurse, fnRecurse)) { yield return itemRecurse; } } } }
Initial URL
http://stackoverflow.com/questions/12318372/linq-nested-list-contains
Initial Description
Credit: Tim Schmelter
Initial Title
Traverse nested lists (IEnumerable)
Initial Tags
c#
Initial Language
C#