Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

How to do nested IGrouping with datatables?

$
0
0

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")) 


Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>