During my session yesterday at the iSDC and RONUA Community Workshop I received a question on how to do a group by together with calculating the sum of the group.
I couldn't remember the right syntax and had to go and look it up. There is actually a sample included on the 101 Linq Samples page (thanks Dragos!).
The query looks like this:
public void Linq80() {
List products = GetProductList();
var categories =
from p in products
group p by p.Category into g
select new {Category = g.Key, TotalUnitsInStock = g.Group.Sum(p => p.UnitsInStock)};
ObjectDumper.Write(categories);
}