【发布时间】:2018-02-09 23:45:26
【问题描述】:
所以我有以下代码:
var itemsGrouped = this.Errors.GroupBy(x => x.UniqueName).AsEnumerable();
var hasErrors = !itemsGrouped.Any((f) =>
{
var errorCount = f.ToArray()
.Where(x => x.ErrorCount.HasValue)
.Count(x => x.ErrorCount.Value > 0);
return errorCount > 2;
});
现在我想检索与 .Any() 查询匹配的单个项目。如何只获得匹配的项目?
【问题讨论】:
-
使用 Where insted of any 怎么样
标签: c# linq linq-to-objects