C#ArrayArray.FindAll

Retrieves all elements that match the conditions defined by a predicate.

문법

Array.FindAll<T>(array, match)

예제

아래 값을 입력하면 예제에 즉시 반영됩니다.

numbers
evens
FindAll
Console
WriteLine
string
int[] numbers = { 1, 2, 3, 4, 5, 6 };
int[] evens = Array.FindAll(numbers, n => n % 2 == 0);
Console.WriteLine(string.Join(", ", evens));   // 2, 4, 6