using System.Collections.Generic;
public static void Main()
Dictionary<string, int> dictionary =new Dictionary<string, int>();
dictionary.Add("linux", 1);
dictionary.Add("windows", 2);
dictionary.Add("mac", 3);
Console.WriteLine("Dictionary after adding values:");
ForEachDictionary(dictionary);
dictionary.Remove("mac");
Console.WriteLine("Dictionary after removing a value:");
ForEachDictionary(dictionary);
public static void ForEachDictionary(Dictionary<string, int> dictionary)
foreach(KeyValuePair<string, int> kvp in dictionary)
Console.WriteLine("Key: "+kvp.Key +" Value:"+kvp.Value);