To store information in
name/value pairs (referred to as key and item),the Dictionary object is used. The Dictionary
object is a more desirable solution to manipulate related data.However,this
object might seem similar to Arrays.
Comparing Dictionaries and Arrays:
- To identify the items in a Dictionary
object,keys are used
- To change the size of the Dictionary object,you do not have to call ReDim
- When deleting an item from a Dictionary, the remaining
items will automatically shift up
- Dictionaries cannot be multidimensional, Arrays can
- Dictionaries have more built-in functions than Arrays
- Dictionaries work better than arrays on accessing random
elements frequently
- Dictionaries work better than arrays on locating items
by their content
The following example creates a Dictionary object, adds some
key/item pairs to it, and retrieves the item value for the key gr:
|