PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, August 12, 2022

[FIXED] How to check if a decimal value from input is greater than a list of decimal

 August 12, 2022     .net, c#, c#-4.0, decimal     No comments   

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)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

1,218,028

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © 2025 PHPFixing