【发布时间】:2017-11-12 20:34:10
【问题描述】:
我尝试使用来自How to count the number of elements that match a condition with LINQ 的代码 它有效,但我的结果总是等于列表中元素的数量。我的清单上有 10 个日期,结果是 10 个。我需要计算具有特定日期的元素。
var zz = both.ToList(); // dates list
int con = list1.Where(p => list1.Contains(zz[0])).Count();
Console.WriteLine("count: " + con);
【问题讨论】: