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.

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

Updated