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 afor
loop, that is not the case if you want to iterate through aDictionary
. How do you go through all the keys in aDictionary
?What syntax is there for a
Dictionary
that matches that for aList
?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 aList
?What syntax is shared between a
List
and aHashSet
?Which is more efficient in general: searching for an element of a list or finding the value given a key in a dictionary?