using System;
using System.Collections.Generic;
public class Program
{
public static void Main()
Dictionary<string, string> dict = new Dictionary<string, string> { {"abc", "1"}, {"def", "2"} };
foreach(var val in dict){
if(val.Value == "2"){
dict.Remove("def");
}