배열의 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