I do have an LINQ query:
var groupedResult = from address in Address.GetAddresses()
group new { City = address.City, HasManyInhabitants = address.Inhabitants > 20 }
by address.City into addressWithInfo
select addressWithInfo;
That works fine. But I'm looking for the method base approach for this query. At the moment I use
var groupedResult = Address.GetAddresses()
.Select(a => new { City = a.City, HasManyInhabitants = a.Inhabitants > 20 })
.GroupBy(a => a.City)
.Select(a => a);
It works, but it doesn't seem to be right because the decompiled code (with ILSpy) looks not similar.
Regards, Torsten