title: Remove Item in Dictionary based on Value
body: <p>I have a <code>Dictionary&lt;string, string&gt;</code>.</p>
  
  <p>I need to look within that dictionary to see if a value exists based on input from somewhere else and if it exists remove it.</p>
  
  <p>ContainsValue just says true/false and not the index or key of that item.</p>
  
  <p>Help!</p>
  
  <p>Thanks</p>
  
  <p><strong>EDIT:</strong> Just found this - what do you think?</p>
  
  <pre><code>var key = (from k in dic where string.Compare(k.Value, "two", true) ==
  0 select k.Key).FirstOrDefault();
  </code></pre>
  
  <p><strong>EDIT 2:</strong> I also just knocked this up which might work</p>
  
  <pre><code>foreach (KeyValuePair&lt;string, string&gt; kvp in myDic)
  {
      if (myList.Any(x =&gt; x.Id == kvp.Value))
          myDic.Remove(kvp.Key);
  }
  </code></pre>