title: Iterating over KeyValuePair (as a key in dictionary) is not working
body: <p>Following is my function:-</p>
  
  <pre><code>public void deleteAllCarsWithType(Dictionary &lt; KeyValuePair&lt;string, string&gt; , car &gt; dictCar, string typeOfCar)
  {
    var keyValuePairs = dictCar.Where(keyValuePair =&gt; keyValuePair.Key.Equals(typeOfCar));
  
    //var count = keyValuePairs.Count();
    //this also gives the size of keyValuePairs as 0.
  
    foreach (var keyValuePair in keyValuePairs)
    {
      dictCar.Remove(keyValuePair.Key);
    }
  } 
  </code></pre>
  
  <p><code>KeyValuePair&lt;string, string&gt;</code> which is the key of the dictionary, has <code>carType</code> as key and <code>carModel</code> as the model of the car.</p>
  
  <p>When I run the unit test of it </p>
  
  <pre><code>[TestMethod]
  public void DeleteSameCarTypeTest()
  {
    Dictionary&lt;KeyValuePair&lt;string, string&gt;, car&gt; Dictionary = new Dictionary&lt;KeyValuePair&lt;string, string&gt;, car&gt;();
    Dictionary.Add(new KeyValuePair&lt;string, string&gt;("x", "y"), new car());
    Dictionary.Add(new KeyValuePair&lt;string, string&gt;("x", "z"), new car());
  
    new Program().deleteAllCarsWithType(Dictionary, "x");
    Assert.AreEqual(0, Dictionary.Count);
  }
  </code></pre>
  
  <p>It fails by saying Expected <code>0</code> and Actual <code>2</code>.</p>
  
  <p>When I debug it, I found out that <code>keyValuePairs</code> have the expected two values (which are with <code>carType</code> "x") but when I step into the foreach loop it's not going in and saying that count of <code>keyValuePairs</code> is <code>0</code>. Then I tried to get the <code>Count</code> of the <code>keyValuePairs</code> which is also coming <code>0</code>. I don't know what I am doing wrong. Please help me out.</p>