← C# Programming learning pathC# Programming · Module 5 of 10
Collections and generics
Store data in List, Dictionary and use generics.
📖 Key ideas
- List<T> is a resizable array: var nums = new List<int>();
- Dictionary<TKey, TValue> maps keys to values.
- HashSet<T> holds unique items; Queue and Stack exist too.
- Generics give type-safe reusable code.
- Collection expressions: int[] a = [1, 2, 3];
💡 Real-life example: Generics are labelled containers: List<Book> only accepts books.
List<T>Generic resizable list
DictionaryKey-value collection
HashSetUnique items set
GenericType parameter <T>