I came across this pretty little piece of code here:
List<DataTable> result = DTHead.AsEnumerable()
.GroupBy(row => row.Field<int>("MIVID"))
.Select(g => g.CopyToDataTable())
.ToList();
It creates a List
of DataTable
's based on the value of a particular field.
Is it possible to tweak this code to instead create a List
of DataTables
based on the number of records? For example, if I have 18 records, I would want that broken into 2 DataTables
with 10 rows each (the last two rows of the second table would be empty). If I have 35 records, I end up with 4 DataTable
's, the last 5 rows empty on table 4.
Thanks!