1

说我有以下内容:

var OrderCounts = from o in Orders
                  group o by o.CustomerID into g
                  select new {
                         CustomerID = g.Key,
                         TotalOrders = g.Count()
                  };

如何将其转换为 Lambda 表达式

4

1 回答 1

9
var OrderCounts = customers
        .GroupBy (o => o.CustomerID)
        .Select (o => new { CustomerID = o.Key, TotalOrders = o.Count () })
于 2012-09-08T13:16:16.500 回答