|
|
Associative Arrays | Associative arrays are generalized arrays that allow indexing
via objects of an arbitrary type (not just integers). Indexers provide
a natural notation for associative arrays. |
|
An associative arrays maps a set of objects (the indexing objects, keys) to another
set of objects (the element objects). |
An example similar to one of the previous indexer examples.
In this example it is illustrated how to index via objects of type string. |
Associative arrays are in C# implemented by means of hashtables in dictionaries | In the lecture about collections, specifically in the interface IDictionary<K,V> we will see how indexers are can be used to access objects of type V via
objects of type K by use of the notation dict[k], where dict is a dictionary
and k is a key of type K. |