- 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
TrueForAll() method in C# Arrays
With TrueForAll() method in arrays, you can check every element for a condition.
Let us see an example −
Example
using System; using System.Text; public class Demo { public static void Main() { int[] val = { 97, 45, 76, 21, 89, 45 }; // checking whether all the array element are more than one or not bool result = Array.TrueForAll(val, res => res > 1); Console.WriteLine(result); } }
Output
True
With TrueForAll() method in arrays, you can check every element for a condition.
Let us see an example −
Example
using System; using System.Text; public class Demo { public static void Main() { int[] val = { 97, 45, 76, 21, 89, 45 }; // checking whether all the array element are more than one or not bool result = Array.TrueForAll(val, res => res > 1); Console.WriteLine(result); } }
Output
True
- Related Articles
- Merge two arrays using C# AddRange() method
- Arrays in C/C++?
- Multidimensional Arrays in C / C++
- Arrays in C/C++ program
- Arrays in C Language
- Associative arrays in C++
- Sorted Arrays in C++
- Multidimensional Arrays in C
- Return Largest Numbers in Arrays passed using reduce method?
- Declare char arrays in C#
- Combine two arrays in C#
- Variable Length Arrays in C and C++
- array-of- arrays double [][] in C#?
- Are arrays zero indexed in C#?
- What are dynamic arrays in C#?

Advertisements