System.Dictionary<TKey, TValue>
implements the map type for c sharp.
initialize
Dictionary<string, string> dict = new Dictionary<string, string>();
usage
dict["battleship"] = "a large warship with big guns";
dict["cruiser"] = "a fast but large warship";
dict["submarine"] = "a ship capable of moving under the water's surface";
Unlike go if you attempt to simply "retrieve" a value which does not exist, an exception is thrown:
Console.WriteLine(dictionary["carrier"]); // KeyNotFoundException
if (dictionary.ContainsKey("gunship"))
Console.WriteLine(dictionary["gunship"]);
Also keys should obviously be immutable since the Dictionary type is implemented as a hash map.