Ale*_*lex 1 c# linq arrays comparison numbers
我有一系列数字:
int[] array = new int[]{ 18, 5, 10, 12, 15, 18 };
Run Code Online (Sandbox Code Playgroud)
如何计算超过一定水平的所有数字(不重复)?LINQ会有什么帮助吗?
例如 - 有10 个以上的数字(18和15,12).
只有1个数字超过15(18,18实际上是相同的数字).
编辑:(抱歉忘了这个)
是否有可能计算超过一定水平的重复?
即在我的"15"的例子中,将有2次重复
编辑2
我的"分组"方式
int count1 = array.Where(x => x > 15).Distinct().Count();
int count2 = array.Where( x => x > 15).Count();
int count3 = count2 - count1;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1904 次 |
| 最近记录: |