 
 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
C# All method
The All Method checks for all the values in a collection and returns a Boolean. Even if one of the element do not satisfy the set condition, the All() method returns False.
Let us see an example −
int[] arr = {10, 15, 20};
Now, using All() method, we will check whether each element in the above array is greater than 5 or not.
arr.AsQueryable().All(val => val > 5);
Example
using System;
using System.Linq;
class Demo {
   static void Main() {
      int[] arr = {10, 15, 20};
      // checking if all the array elements are greater than 5
      bool res = arr.AsQueryable().All(val => val > 5);
      Console.WriteLine(res);
   }
}
Output
True
Advertisements
                    