Collections

Collections hold groups of values: an array for a fixed set, a List<T> for a set that grows and shrinks, a Dictionary<TKey, TValue> for looking something up by key. Inventories, spawn points, enemies in range, and item databases are all collections, and picking the right one is the difference between code that reads clearly and code that fights you.

More in C# Foundations

  1. Variables & Types
  2. Control Flow & Loops
  3. Methods & Classes
  4. Collections
  5. Interfaces & Inheritance
  6. Delegates & Events

All 42 topics in the Learn Unity Roadmap