Use the Take Operator to limit the number of rows from a DataTable.

By [)ia6l0 iii

You can use the Linq Take operator and return the top x rows of any enumerable object like a DataTable.

Sample snippet below shows you how to do that:

IEnumerable<DataRow> dataRows =  myDataTable.AsEnumerable().Take(10);

This would return you the 10 top rows of the DataTable.

Use the Take Operator to limit the number of rows from a DataTable.  (1492 Views)