Issue
I have a decimal list. I need to find if a decimal
input is greater than any of the value present in the list.
Decimal threshold = 20;
List<Decimal> InputList = new List<Decimal>() { 10, 20, 35 };
Please note this input list might have one or more items in the list.
I want to check if one of the items is greater than the threshold value, then do something else.
Solution
You can use Any
. It checks if at least one element in the list matches the condition.
InputList.Any(x => x > threshold);
Answered By - Reyan Chougle Answer Checked By - Clifford M. (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.