3 ms·
Cool. Now how about companies .Where(c => c.Name.StartsWith("A")) .GroupBy(c => c.Sector, c => c.ProfitAndLoss) .Select(g => new {Sector = g.Key, Profit
by moomin 15y ago
Cool. Now how about
companies
.Where(c => c.Name.StartsWith("A"))
.GroupBy(c => c.Sector, c => c.ProfitAndLoss)
.Select(g => new {Sector = g.Key, Profitability = g.Sum()}
Closures are massively more compact than running around with inner classes for everything.