A collection in C# is any type that holds a group of values. The framework gives you a lot of them, so the hard question is usually which one to pick.

Use List when you want an ordered group you can add to, Dictionary when you look things up by key, HashSet when you only care whether something is present, and an array when the size never changes and you need the memory laid out flat. Past that it is a trade-off between lookup speed, insert speed, memory and whether more than one thread touches it.

The interfaces matter as much as the classes. IEnumerable lets a caller walk your data once, ICollection adds counting and adding, and IList adds access by index. Accept the smallest one that does the job and you keep your options open.

The articles below are grouped by the type you are reaching for.

Choosing a Collection

Start here if you are not sure which type you want.

Lists

List is the default collection in C#, and most of these articles are about the operations that are easy to get slightly wrong.

Dictionaries and Lookups

Key to value, and the handful of ways to ask a dictionary a question without throwing.

Sets, Queues and Stacks

The collections you pick when the shape of the access matters more than the order.

Span, Memory and Allocation-Free Work

How to look at a slice of data without copying it, which is where most of the easy performance wins live.

Arrays

Fixed size, contiguous memory, and still the fastest thing in the box when you know how many items there are.

More Collection Techniques

Everything else we have written about working with groups of values.

Where to Go Next

LINQ is how you query what is in these:

Still unsure? Start with List or Dictionary and change it later. Swapping a collection out is a small refactor, and by then you will know more about how the data is used.