I have a linq query which is calculating particular data. Now I want that query to be typecasted to DataTable
. Here is the query :
var query = dt.AsEnumerable()
.GroupBy(row => new
{
Name = row.Field<string>("Name")
})
.Select(g => new
{
Name = g.Key.wcName,
quantity = g.Count()
});
I have heard about .CopyToDataTable
which is used here but it is not showing. How can I convert the query to datatable ?