AsEnumerable().Take
c#, datatable, linq, linq-to-dataset
Solution
Yes, this is a correct way to take first N rows from your data table. Use CopyToDataTable extension to create new data table from query result:
DataTable dt = dtResult.AsEnumerable()
.Take(n)
.CopyToDataTable();
Problem
I want to take fist n number of records from a data table. I don't want to run a loop which I already know. I'm trying to do this ``` DataTable dt = dtResult.AsEnumerable().Take(n) ``` is the right way..? what is the process to make this "n records" to be in another datatable..?