DataTable tblFiltered = dtable.AsEnumerable()
.Where(row => row.Field<String>("empsalary") > 12000)
.OrderByDescending(row => row.Field<String>("empsalary"))
.CopyToDataTable();
The above code throws The Type arguments for the method Syste.Linq.Enumerable.AsEnumerable cannot be inferred from the usage.
You haven't told us the type of dtable
, but assuming it's DataTable
, I suspect you intended to use DataTableExtensions.AsEnumerable
rather than Enumerable.AsEnumerable
... in which case you're probably just missing either a using
directive to import the extension method:
using System.Data;
... or (more likely) a reference to the System.Data.DataSetExtensions
assembly which contains the DataTableExtensions
type.
See more on this question at Stackoverflow