Dictionary enumeration in C#
To enumerate a dictionary you either enumerate the values within it: Dictionary<int, string> dic; foreach(string s in dic.Values) { Console.WriteLine(s); } or the KeyValuePairs foreach(KeyValuePair<int, string> kvp in dic) { Console.WriteLine(“Key : ” + kvp.Key.ToString() + “, Value : ” + kvp.Value); } or the keys foreach(int key in dic.Keys) { Console.WriteLine(key.ToString()); } If you … Read more