# switch Expression

*noun*

say it: **“SWICH ek-SPRESH-un”** **/swɪtʃ ɪkˈsprɛʃən/**

A C# expression that matches a value against patterns and gives back the result of the first match.

## What is **switch Expression** in C#?

**switch Expression** — An expression that selects and returns a value by matching an input against patterns.

```csharp
class Shirt
{
    string SizeName(string size)
    {
        return size switch
        {
            "M" => "Medium",
            _ => "Other"
        };
    }
}
```

## In a sentence

- “A **switch expression** turns the size letter into its full name in four short lines.”

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

Updated: November 9, 2026

Source: https://www.ask-codey.com/glossary/switch-expression
