I have a datatable like
public DataTable functiongettable()
{
DataTable dt = new DataTable();
dt.Columns.Add("Name");
dt.Rows.Add("Name1");
dt.Rows.Add("Name5");
dt.Rows.Add("Name6");
dt.Rows.Add("Name3");
dt.Rows.Add("Name3");
dt.Rows.Add("Name6");
dt.Rows.Add("Name3");
dt.Rows.Add("Name5");
dt.Rows.Add("Name5");
return dt;
}
By using linq query I want to perform Sorting and need unique records.
I am doing like this
var query = from c in functiongettable().AsEnumerable().OrderBy("Name").Distinct() select c;
But getting error:
The type arguments for method 'System.Linq.Enumerable.OrderBy(System.Collections.Generic.IEnumerable, System.Func)' cannot be inferred from the usage. Try specifying the type arguments explicitly.
How to solve this?
Thanks in advance