Collections in C#
Arrays have a fixed size; collections grow and shrink as you need. You will work with List<T> and Dictionary<TKey, TValue>, the two collections you will use most.
Updated
Array Review in C#
- What Arrays Solve (Apprentice): A quick review of what arrays do well, fast access by position, one name for a group, and easy looping, before meeting their limits.
- But Arrays Can Be Tedious (Apprentice): Arrays can't grow or shrink, so adding, inserting and removing elements means making new arrays and shifting values by hand.
Lists in C#
- Introduction to List<T> (Apprentice): A List<T> holds values of one type and grows and shrinks for you; the T says which type, like int or string.
- Working with List<T> (Apprentice): Add, insert, read, find, remove, sort and loop through the items of a C# List<T>.
Dictionaries in C#
- Dictionaries in C# (Apprentice): A Dictionary<TKey, TValue> stores values under unique keys, so you can look one up by its label instead of its position.
Exercise: Collections
- Exercise: Collections (Apprentice): Solve 14 problems with List<T> and Dictionary<TKey, TValue> (filtering, searching, counting, looking up and combining) and check each one with tests.