12.5. Chapter Review Questions
- Which is true for a
Dictionary
: is it mutable or immutable?
- Though for some collections, like arrays and lists,
you can fairly easily replace a
foreach
loop with a for
loop, that is not the case if you want to iterate
through a Dictionary
. How do you go through all the keys in
a Dictionary
?
- What syntax is there for a
Dictionary
that matches that for a List
?
- How is a
Dictionary
like an array? How is it different?
Dictionary
values are of arbitrary type. What is the restriction on
key types?
- How is a
HashSet
different than a List
?
- What syntax is shared between a
List
and a HashSet
?
- Which is more efficient in general:
searching for an element of a list or finding the
value given a key in a dictionary?