# FirstOrDefault()

*noun*

say it: **“FURST or dih-FAWLT”** **/fɜːrst ɔːr dɪˈfɔːlt/**

The LINQ method that returns the first matching item, or a default such as null when there is none.

## What does **FirstOrDefault()** do in C#?

**FirstOrDefault()** — A LINQ operation returning the first item, or the type's default value when none exists.

```csharp
class NameFinder
{
    string? First(IEnumerable<string> names)
    {
        return names.FirstOrDefault();
    }
}
```

## In a sentence

- “**FirstOrDefault**(p => p.ProductId == 7) returned null when there was no product 7.”

Level: Freelancer · [More C# terms at this level](https://www.ask-codey.com/glossary?category=c-sharp&level=4)

Updated: November 9, 2026

Source: https://www.ask-codey.com/glossary/firstordefault
