请考虑以下代码:
var result = data
.GroupBy(a => groupA.Contains(a.Group) ? "A" :
groupB.Contains(a.Group) ? "B" :
"N/a")
.Select(a => new
{
KEY = a.Key,
VALUE = a.Count()
});
任何人都可以帮助如何转换GroupBy
为LINQ
版本?
谢谢
编辑 1)
我想要这种风格:
from a in ....
group a by ....
select ...