【发布时间】:2015-06-26 01:19:13
【问题描述】:
我编写了以下代码来查找对象列表中的常见对象
https://dotnetfiddle.net/gCgNBf
........
var query = setOfPersons
.SelectMany(l => l.Select(l1 => l1))
.GroupBy(p => p.Id)
.Where(g => g.Count() == setOfPersons.Count);
之后,我需要将“查询”转换为“人员”对象列表 ( List ) 以实现其他目标。
我尝试使用 "ToList()"... 但它说:
"无法将 IGrouping 转换为 List"。
有人可以帮我解决吗?
【问题讨论】: