Linq – Multiple Group By

This has been bugging me for a LONG time!

I’ve finally found an example of how to group by multiple values using LINQ:
IList doc_infos = new List();

doc_infos.Add(new doc_info { region = "UK", price = 100, currency = "US" });
doc_infos.Add(new doc_info { region = "US", price = 100, currency = "US" });

var docs = doc_infos.GroupBy(x => new { x.price, x.currency })
.Select(group => new { d = group.Key, Count = group.Count() });

For more examples, have a look here.