main.cs370 chars8 lines
In this example, we are using LINQ to partition the list into batches of 20. The Select
method is used to include the current index along with each item in the list. The GroupBy
method then groups these items based on their index divided by the batch size. Finally, the Select
method is called again to project the groups of items into lists.
The output will be a list of lists, where each inner list contains 20 elements (except for the last batch which may contain fewer).
gistlibby LogSnag