Array of dictionaries or one massive dictionary?

Alright, I’m facing this decision. Should I make an array of dictionaries, where each element in an array would be a dictionary, and to access it I’d call

dictionaryArray[index]["dictionary_key"] = "foo";

or instead have a massive dictionary and use the index as a prefix?

massiveDictionary[index+"dictionary_key"] = "foo";

I’m asking mainly, because I don’t know what the algorithms of generic dictionaries are, and whether the increasing number of elements impacts their performance or not.


The Dictionary generic
class provides a mapping from a set of
keys to a set of values. Each addition
to the dictionary consists of a value
and its associated key. Retrieving a
value by using its key is very fast,
close to O(1), because the
Dictionary class is
implemented as a hash table. Note The
speed of retrieval depends on the
quality of the hashing algorithm of
the type specified for TKey.

I think performances should not be a major issue :slight_smile: