Skip to content

Instantly share code, notes, and snippets.

View waldyrfelix's full-sized avatar

Waldyr Felix waldyrfelix

View GitHub Profile
@waldyrfelix
waldyrfelix / gist:1024270
Created June 14, 2011 03:44 — forked from juanplopes/gist:1024221
BatchAggregate
public static IEnumerable<IList<T>> BatchAggregate<T>(this IEnumerable<T> source, int batchSize)
{
var enumerator = source.GetEnumerator();
for (int page = 0; enumerator.MoveNext(); page = page + batchSize)
{
var list = source
.Skip(page)
.Take(batchSize)
.ToList();