Is it possible to fill a hashtable when it is first defined?
For example, here is some similar PHP code:
var $AA = new array("one" => 1, "two" => 2);
I would like to do something like this in C#. In fact, it is quite possible Hashtable is not the best tool.
take care,
lee
Look into the collection initializers – yes, it’s possible. For dictionaries, see here. You can declare your dictionary and fill it with a collection of key/value pairs.
A simpler example than MSDN provides: