I've got a problem i need to create 2 dimensional table which will be indexed by string for example:
table["London","Cambridge"] = 120;
or jagged:
table["London"]["Cambridge"] = 120;
How to declare Collection or array that can handle this? I found solution but im not sure it is the best.
Dictionary<string, Dictionary<string, int>> test = new Dictionary<string, Dictionary<string, int>>();
But when i wanna create a new value i need to initialize new dictionary, so why i thing that solution is not the rightest:
table.Add("London", new Dictionary<string, int> {{"Cambridge",120}});
So how in the best way create 2 dimensional array indexed by string (mayby create new class that can handle this)?