How to do nested IGrouping with datatables? RRS feed

  • Question

  • I have DataTable with following columns. "Country", "State","City","NumberOfPeople". I want to group by Country and then by State. How do i do that? Note that the datasource is DataTable. The below query which does the grouping by Country but now i want further group by State and then loop it.

    var result = MyDataSet.Tables["data"]
                    .GroupBy(x => x.Field<string>("Country")) 

    Wednesday, March 19, 2014 4:24 PM


  • i think i got it,  sorry i should have check the forum first

    • Marked as answer by lax4u Wednesday, March 19, 2014 4:39 PM
    Wednesday, March 19, 2014 4:39 PM