 
 Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
All Method in C#
The All() extension method is part of the System.Linq namepspace. Using this method, you can check whether all the elements match a certain condition or not.
Set an array −
int[] arr = { 6, 7, 15, 40, 55 };
The following is an example. It checks whether all the elements in the array is greater than and equal to 2 or not −
arr.All(element => element > = 2);
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.All(element => element >= 2);
      Console.WriteLine(res);
   }
}
Output
True
Advertisements
                    