Dictionary<int, Customer> col = customers.ToDictionary(c => c.CustomerID);
Dictionary<string, double> customerOrdersWithMaxCost = (from oc in
(from o inorders join c in customers on o.CustomerID equals c.CustomerID
select new { c.Name, o.Cost })
group oc by oc.Name into g
select g).ToDictionary(g => g.Key, g => g.Max(oc => oc.Cost));
|