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
热门推荐
5 圆圆的祝福语简短
10 英文祝福语简短带名字
11 感谢父母的简短祝福语
12 女生 节日祝福语简短大气
13 唯美的祝福语简短的
14 鼓掌祝福语简短10字
15 年月日祝福语简短
16 国庆简短幽默祝福语
17 对生活祝福语简短精辟
18 低调祝福语简短10字