# switch Expression

An expression that selects and returns a value by matching an input against patterns.

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

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

Updated: September 27, 2026

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