TrueForAll() 方法在 C# 数组中
使用数组中的 TrueForAll() 方法,你可以根据条件检查每个元素。
让我们看一个示例 −
示例
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);
}
}输出
True
使用数组中的 TrueForAll() 方法,你可以根据条件检查每个元素。
让我们看一个示例 −
示例
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);
}
}输出
True
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 语言
C++
C#
MongoDB
MySQL
Javascript
PHP