-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
result: !a1!b2!c3!a4!b5!c1!a2!b3!c4!a5!b1!c2!a3!b4!c5!a1... (Hope I got that
right, you get the idea). The length of the IEnumerables is unknown of course
and the result should be lazy-evaluated.
There may already be a way to do this but I didn't see anything obvious like
this:
public static IEnumerable<T> Interleave<T>(params IEnumerable<T>[]
sequencesToInterleave)
{
...
}
foreach (var item in Interleave(new string[] { "!" }, new string[] { "a", "b",
"c" }, new string[] { "1", "2", "3", "4", "5" }))
{
Console.Write(item.ToString());
}
Original issue reported on code.google.com by virtan...@gmail.com
on 9 May 2014 at 12:18