IntDictionary
Use the
IntDictionary
type to map string values to integer
values. This example shows how to map the names of weekdays to numbers:
int DayOfWeek(string name) { IntDictionary weekDays = CreateIntDictionary(); weekDays["mon"] = 1; weekDays["tue"] = 2; weekDays["wed"] = 3; weekDays["thu"] = 4; weekDays["fri"] = 5; weekDays["sat"] = 6; weekDays["sun"] = 7; return weekDays[ToLower(name)]; }