Datatable select by row range C #

Does anyone know how to select datatable by row range? let's say if I need to pull records in datatable from line # 20 - # 50.

+6
source share
1 answer

If you want to include lines 20 and 50, I think this will work:

var rows = (from r in table.AsEnumerable() select r).Skip(19).Take(31); 

update:

or more succinctly:

 var rows = table.AsEnumerable().Skip(19).Take(31); 
+14
source share

All Articles