Can someone suggest a way to create batches of a certain size in linq?
Ideally I want to be able to perform operations in chunks of some configurable amount.
static IEnumerable> TakeBatch(IEnumerable ts,int batchSize) { return from @group in ts.Select((x, i) => new { x, i }).ToLookup(xi => xi.i / batchSize) select @group.Select(xi => xi.x); }