GroupBy

The LINQ operator that splits a sequence into groups sharing a key, each group carrying its key and its own items.

In more detail

items.GroupBy(p => p.Category) yields one group per category, in the order the keys were first seen. Each group is itself a sequence you can count or sum.

Related terms

Taught in

References