none
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"]
                    .AsEnumerable()
                    .GroupBy(x => x.Field<string>("Country")) 

    Wednesday, March 19, 2014 4:24 PM

Answers

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

    http://social.msdn.microsoft.com/Forums/en-US/ca15f6d3-b358-4a86-82c6-d749bc9e7e1c/how-to-do-a-nested-groupby?forum=linqprojectgeneral

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