# FirstOrDefault()

A LINQ operation returning the first item, or the type's default value when none exists.

## 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();
    }
}
```

Level: Freelancer · [More C# terms at this level](https://www.ask-codey.com/glossary/subjects/c-sharp/freelancer)

Updated: September 27, 2026

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