Question: I have a dictionary collection as bleow:

```
mydic.addvalue(key1, val1)
mydic.addvalue(key2, val1)
mydic.addvalue(key3, val1)
mydic.addvalue(key4, val2)
mydic.addvalue(key5, val2)

```

From the above dictionary I want to delete all the entries where value == "val1", so that the result would have only following entry:

```
mydic.addvalue(key4, val2)
mydic.addvalue(key5, val2)

```

My VB source code is on VS2008 and targeted for 3.5

Answer: 
You can also use

```
var x= (from k in mydic
           where k.Value != val1
           select k).ToDictionary(k=>k.key);

```

x will not have any of the val1's
The answer it's old but this is how I do the same thing without create another Dictionary.

```
foreach (KeyValuePair<TKey, TValue> x in MyDic) {

  if (x.Value == "val1")) 
  {  MyDic.Remove(x.Key); } 
}

```