Lea*_*ner 2 .net c# decimal c#-4.0
我有一个小数列表.我需要查找decimal输入是否大于列表中的任何值.
Decimal threshold = 20;
List<Decimal> InputList = new List<Decimal>() { 10, 20, 35 };
Run Code Online (Sandbox Code Playgroud)
请注意,此输入列表可能在列表中有一个或多个项目.
我想检查其中一项是否大于阈值,然后再做其他事情.
你可以用Any.它检查列表中是否至少有一个元素与条件匹配.
InputList.Any(x => x > threshold);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
105 次 |
| 最近记录: |