如果我使用扩展方法语法,下面的查询会是什么样子?
var query = from c in checks
group c by string.Format("{0} - {1}", c.CustomerId, c.CustomerName)
into customerGroups
select new { Customer = customerGroups.Key, Payments = customerGroups }
最佳答案
看起来像这样:
var query = checks
.GroupBy(c => string.Format("{0} - {1}", c.CustomerId, c.CustomerName))
.Select (g => new { Customer = g.Key, Payments = g });
关于c# - GroupBy 与 linq 方法语法(不是查询语法),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/967099/