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