I want to split the datatable into N parts. Lets assume that N = 5.
If the datatable.rows.count is 13, the datatable should split to 3 sets where the:
- First set has 5 records.
- Second set has 5 records and
- Third set has 3 records.
If the datatable.rows.count is 16, the datatable should split to 4 sets, where the:
- First set has 5 records
- Second set has 5 records
- Third set has 5 records and
- Fourth set has 1 record.
How is it possible ? While searching the web, I got to know that it can achieved like this Split a collection into `n` parts with LINQ?
But I want to do a simple function where the datatable and value of N is passed.
It's confusing to loop inside a loop.