How to group by on multiple columns from datatable with linq?

Viewed 23281

I am using Linq to group by some columns in my datatable

List<DataTable> tables = ds
  .Tables[0]
  .AsEnumerable()
  .GroupBy(row => row.Field<string>("EMAIL"), row.Field<string>("NAME"))
  .Select(g => g.CopyToDataTable())
  .ToList();

I am getting an build error "The name 'row' does not exists in the current context" ? How to handle multiple group by ?

1 Answers
Related