C# Array FindAll() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Array

Definition

In C#, Array.FindAll builds a new array that contains every element for which your predicate returns true. Elements that fail the test are skipped.

If nothing matches, you get an empty array (Length 0)—not null. The original array is not modified.

This is a static member of System.Array. You call it with the class name, such as Array.FindAll(...). Arrays in C# have a fixed length after creation; use List<T> when the count must grow.

Syntax

Pass the source array and a predicate. Store the new filtered array.

C#
int[] big = Array.FindAll(nums, x => x >= 10);
CallWhat it does
Array.FindAll(nums, x => x >= 10)All ints at least 10.
Array.FindAll(names, n => n.Contains("a"))All names containing “a”.

Find returns only the first match. Exists returns only true/false.

Library declarations
C#
public static T[] FindAll<T>(T[] array, Predicate<T> match);

Parameters

ParameterDescription
arrayRequired. Source array.
matchRequired. Predicate deciding which elements to keep.

Return Value

Return ValueDescription
T[]New array of matches. Empty when nothing matches.

C# Examples

Example 1 — Keep Numbers in Range

Collect every int that is at least 10.

C#
using System;

class Program {
    static void Main() {
        int[] nums = { 3, 10, 7, 25, 12 };
        int[] big = Array.FindAll(nums, x => x >= 10);

        Console.WriteLine(string.Join(", ", big));
        Console.WriteLine("Count: " + big.Length);
    }
}

How It Works

  1. Filter. Predicate keeps values ≥ 10.
  2. New array. big is separate from nums.
  3. Order kept. Matches appear in the same order as the source.
  4. Source intact. nums still holds five elements.

Example 2 — Empty Array When Nothing Matches

A too-strict predicate yields Length 0.

C#
using System;

class Program {
    static void Main() {
        string[] names = { "Ann", "Bob" };
        string[] hits = Array.FindAll(names, n => n.StartsWith("Z"));

        Console.WriteLine("Length: " + hits.Length);
        Console.WriteLine("Is empty: " + (hits.Length == 0));
    }
}

How It Works

  1. Not null. You still get a real array object.
  2. Length 0. Safe to loop; the body never runs.
  3. Strict test. No name started with Z.
  4. Different from Find. Find would return null for strings here.

Example 3 — Names Containing a Letter

Keep names that contain the letter a (case-sensitive).

C#
using System;

class Program {
    static void Main() {
        string[] names = { "Ann", "Bob", "Carla", "Dan" };
        string[] hits = Array.FindAll(names, n => n.Contains("a"));

        foreach (string n in hits) {
            Console.WriteLine(n);
        }
    }
}

How It Works

  1. Contains. Character a must appear as lowercase a.
  2. Ann skipped. “Ann” has A/n only—no lowercase a.
  3. Two hits. Carla and Dan both contain a.
  4. foreach print. One name per line.

Frequently Asked Questions

A new empty T[] with Length 0, not null.
No. It returns a new array of matches.
Find returns the first matching element (or default). FindAll returns every match in a new array.
Yes. Elements keep their relative order from the source.
Yes. Pass a method group that matches Predicate<T>.

Next: FindIndex()

Return the index of the first element that matches a predicate, or -1 with System.Array.

FindIndex() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

11 people found this page helpful