请考虑这两个查询及其结果:
var result = ent.tblCustomGroupBies
.GroupBy(a => groupA.Contains(a.Group.Value) ? "A" :
groupB.Contains(a.Group.Value) ? "B" :
"N/a")
.Select(a => new
{
KEY = a.Key,
VALUE = a.Count()
});
结果是GridView
::
第二个查询:
var result3 = from p in ent.tblCustomGroupBies
group p by new { Criterion = groupA.Contains(p.Group.Value) ? "A" :
groupB.Contains(p.Group.Value) ? "B" :
"N/a" }
into g
select new { KEY = g.Key, VALUE = g.Count() };
结果是GridView
::
为什么Select(a => new)
在第一个查询中显示键列但select new
不显示?