- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Any Extension method in C#
The Any() extension method is part of the System.Linq namepspace. Using this method, you can check whether any of the elements matches a certain condition or not.
Firstly, set an array with elements −
int[] arr = { 6, 7, 15, 40, 55 };
The following is an example. It checks whether any of the element in the array is greater than and equal to 20 or not −
arr.Any(element => element >= 20);
Here is the complete code −
Example
using System; using System.Linq; class Program { static void Main() { int[] arr = { 6, 7, 15, 40, 55 }; bool res = arr.Any(element => element >= 20); Console.WriteLine(res); } }
Output
True
- Related Articles
- C# Any Method
- Extension Methods in C#
- Is there any way to load an extension in chrome browser using Selenium Webdriver?
- What is default, defender or extension method of Java 8?
- C# program to get the extension of a file in C#
- Package extension utility in Python
- Perl File Extension
- How to raise Python exception from a C extension?
- Get file extension name in Java
- How to change file extension in Python?
- How to perform a left outer join using linq extension methods in C#?
- C++ Program to Create a Random Linear Extension for a DAG
- Start safari with extension using safariDriver in selenium.
- Is there any alternative for OpenCV imshow() method in Java?
- What does the any() method do in the pandas series?

Advertisements