So I have a method that looks like this:
public static List<List<List<string>>> Split(List<List<string>> source, int chunksize)
{
return source
.Select((x, i) => new { Index = i, Value = x })
.GroupBy(x => x.Index / chunksize)
.Select(x => x.Select(v => v.Value).ToList())
.ToList();
}
While this is nice and elegant and readable, unfortunately that groupby is killing performance because of the implicit sort. I need a way to rewrite this to be more performant, while still being reasonably elegant.