TrueForAll() विधि के साथ सरणियों में, आप प्रत्येक तत्व को किसी शर्त के लिए जांच सकते हैं।
आइए एक उदाहरण देखें:
उदाहरण
using System;
using System.Text;
public class Demo {
public static void Main() {
int[] val = { 97, 45, 76, 21, 89, 45 };
// जांचें कि क्या सभी सरणी तत्व 1 से अधिक हैं
bool result = Array.TrueForAll(val, res => res > 1);
Console.WriteLine(result);
}
}
आउटपुट
True
TrueForAll() विधि के साथ सरणियों में, आप प्रत्येक तत्व को किसी शर्त के लिए जांच सकते हैं।
आइए एक उदाहरण देखें:
उदाहरण
using System;
using System.Text;
public class Demo {
public static void Main() {
int[] val = { 97, 45, 76, 21, 89, 45 };
// जांचें कि क्या सभी सरणी तत्व 1 से अधिक हैं
bool result = Array.TrueForAll(val, res => res > 1);
Console.WriteLine(result);
}
}
आउटपुट
True