Skip to main content

Batching with LINQ


items.Select((item, inx) => new { item, inx })
                    .GroupBy(x => x.inx / maxItems)
                    .Select(g => g.Select(x => x.item));

https://stackoverflow.com/questions/13731796/create-batches-in-linq