ojl*_*ecd 13
使用扩展方法是最简单的方法
int count = list.Count(i => i > 10);// get the count of those which is bigger than 10
Run Code Online (Sandbox Code Playgroud)
如果要计算列表中项目数的计数,可以使用表达式执行此操作:
int count = myList.Count(i => i.Equals(5));
Run Code Online (Sandbox Code Playgroud)