Good stuff Tim,
For further discussion, you may stand to gain slightly better performance from a Dictionary type. It is essentially the same, however, the Dictionary is a typed variant. This means, the collection is aware of the type of data stored and doesnt suffer in boxing\unboxing penalties. Also you get type safety to help potential avoid runtime errors.
One potential pitfall, that I dont believe affects us in this context is that HashTables are thread safe, while Dictionaries are not.
A final thing which I believe is of no consequence in our specific case is that a Dictionary will keep the order of your items you add, while there is no guarantee of that in a hash.
To use a ditionary, you just need to define the type of the key (1) and value (2) like:
var dic = new Dictionary<int, string>();
dic.Add(1,“One”);
dic.Add(2,“Two”);
Since they are similar, you still have access to ContainsKey and ContainsValue.
also dont forget to include:
using System.Collections.Generic;