How to split a data table using a row index


I want to split a data table in two, based on the row index. Initially I used a for each row with a if inside it, but it took too long. Do you know another way that can improve efficiency?

Many thanks,

Hi ,
It can be split using the Linq

  1. Take first n rows by using dataTable.AsEnumerable().Take(2).CopyToDataTable()
  2. Then you can take remaining by skip n rows
1 Like