linq group by
var customers = BuildCustomers(); var results = from c in customers from o in c.Orders where c.FirstName.Length >=5 && o.Product == "Milk" group by c into avg select new { avg.Key.FirstName, avg.Key.LastName, avg =avg.Average( o => o.Quantity ) }; ObjectDumper.Write(results, Writer );