Is there any way to apply skip and take in Datatable in asp.net core 2.0. without converting to any class type? I have used stored procedure to get data and convert to Datatable, I want to apply pagination in this Table, how can I do this?
You can not use becuase it does not implement the IEnumerable<T>
. But you can do this by using AsEnumerable
extension method.
DataTable dt = new DataTable();
IEnumerable<DataRow> rows = dt.AsEnumerable().Skip(10).Take(10);
Above solution works for .Net Core version >= 3
For .Net Core version 2. You need to install the package.
System.Data.DataExtensions