MCTS Exam 70-536 – Collections and Dictionaries
Good morning,
today I start with Collections and Dictionaries during my MCTS exam-preparation. As usual I provide my notes on that topic as a little help and motivation for other students.
Collections
- namespaces where we find Collections are System.Collections and System.Collections.Specialized
- Collectionstypes are:
- ArrayList – stores any type of object, expands as required. Accessable by zero based index or within a foreach_loop. Use .Add, .AddRange, .Remove, .Insert and .Sort (Objects need to implement IComparable), .Reverse (Reverse current order)
- Queue – First in, First out (FIFO) collection. Use .Enqueue and .Dequeue to add and remove objects and .Peek to lookup an object on a specified position. Use .Clear to remove all objects
- Stack – Last in, First out (LIFO) collection. Use .Push and .Pop to add and remove objects and .Peek to loopup an object on a specified position. Use .Clear to remove all objects
- StringCollection – As ArrayList, but strongly typed for strings, does not support sorting
- BitArray / BitVector – Collection of boolean values. BitVector is limited to 32 bits, BitArray stores more.
Dictionaries
- Hashtable – name/value pairs that can be retrieved by name and index
- SortedList – sorted automatically by key. Array of DictionaryEntry objects
- StringDictionary – Hashtable that is strongly typed to string
- ListDictionary – Dictionary optimized for less then 10 items
- HybridDictionary – Advantage of ListDictionary when less then 10 items, otherwise behaves like a Hashtable
- NameValueCollection – pairs of strings, accessable by index or name(key). Can store multiple values for the same key.


