C#计数和长期计数
示例
Count返回中的元素数IEnumerable<T>。Count还公开了一个可选的谓词参数,该参数使您可以过滤要计数的元素。
int[] array = { 1, 2, 3, 4, 2, 5, 3, 1, 2 };
int n = array.Count(); //返回数组中元素的数量
int x = array.Count(i => i > 2); //返回数组中元素的数量 greater than 2LongCount的工作方式与相同,Count但返回类型为long,用于计数IEnumerable<T>比int.MaxValue
int[] array = GetLargeArray(); long n = array.LongCount(); //返回数组中元素的数量 long x = array.LongCount(i => i > 100); //返回数组中元素的数量 greater than 100
热门推荐
10 感谢韩语老师祝福语简短
11 升职文案高级祝福语简短
12 花童结婚祝福语大全简短
13 向国庆送祝福语简短
14 什么寄语简短祝福语女生
15 客户回礼祝福语大全简短
16 女孩生日祝福语简短创意
17 家长回复节日祝福语简短
18 给外婆敬酒祝福语简短