# GroupBy()

*noun*

say it: **“GROOP BY”** **/ɡruːp baɪ/**

The LINQ method that collects items sharing the same value into groups.

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

## In a sentence

- “**GroupBy**(p => p.CategoryId) gave me one group per category.”

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

Updated: November 9, 2026

## In other subjects

- [groupby() in Python](https://www.ask-codey.com/glossary/groupby-python)

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