# GroupBy()

A LINQ operation that gathers items sharing the same key.

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

**GroupBy()** — A LINQ operation that gathers items sharing the same key.

```csharp
class OrderGroups
{
    object ByStatus(IEnumerable<Order> orders)
    {
        return orders.GroupBy(order => order.Status);
    }
}

record Order(string Status);
```

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/groupby
