Try to add duplicate entry to Dictionary
using System; using System.Collections.Generic; public class Example { public static void Main() { Dictionary<string, string> openWith = new Dictionary<string, string>(); openWith.Add("A", "a"); openWith.Add("B", "b"); openWith.Add("C", "c"); try { openWith.Add("A", "a"); } catch (ArgumentException) { Console.WriteLine("already exists."); } } }