Use the Remove method to remove a key/value pair.
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");
openWith.Remove("A");
if (!openWith.ContainsKey("A"))
{
Console.WriteLine("Key \"A\" is not found.");
}
}
}
Related examples in the same category