Caffeinated Coder
Book an appointment
Lesson 12 · Working with data

Collections

A collection keeps many values under one name. Follow a 13-line program: a List<int> stores its values in a hidden array, fills it, and when it is full makes a new array twice as big and copies across; a Dictionary<int, string> uses each key's hash code to pick a bucket, so TryGetValue goes straight to the right one. The program prints 85 Sara.

14 min11 steps5 questionsIntermediate
Fig 12 · Interactive
Loading figure…
or ← →

Quiz Unlocks after the last step.