var groupedProducts = from product in products
group product by product.Category into g
select new { Category = g.Key, Count = g.Count() };
var groupedProducts = from product in products
group product by product.Category into g
select new { Category = g.Key, Count = g.Count() };