I have a dictionary collection as bleow:
mydic.addvalue(key1, val1) mydic.addvalue(key2, val1) mydic.addvalue(key3, val1) mydic.addvalue(key4, val2) mydic.ad
You first need to find all keys for which the associated value is val1:
val1
var keysToRemove = mydic.Where(kvp => kvp.Value == val1) .Select(kvp => kvp.Key) .ToArray();
Then you can remove each of those keys:
foreach (var key in keysToRemove) { mydic.Remove(key); }