Вот лучший способ реализовать это (я использую Int32 как пример типа для хранения):
Dictionary<String,Int32> dictionary = new Dictionary<String,Int32>
{
// this just loads up the list with
// some dummy data - notice that the
// key is a string and the value is an int
{ "one", 1 },
{ "two", 2 },
{ "three", 3 },
};
Теперь вы можете получать значения из словаря <,> следующим образом:
dictionary["one"]; // returns 1
dictionary["two"]; // returns 2