I've had a few occaisions where I would like to use an already defined anonymous type field and haven't been able to figure this out. Here is what I want to do: List Product > products = new List Product >(); var categories = from p in products group p by p.Category into g select new { Category = g.Key, TotalApples = g.Sum(p => p.ApplesInStock), TotalOranges = g.Sum(p => p.OrangesInStock), TotalFruit = TotalApples + TotalOranges, }; I have to call the sum of Apples & Oranges again on TotalFruit if
Read More...