title: Remove all items that match a condition in IDictionary
body: <p>I'm trying to remove all elements in a IDictionary object that match a condition.</p>
  
  <p>E.g. the IDictionary contains a set of keys and corresponding values (let say 80 objects). The keys are strings, the values could be of different types (think extracting metadata from a wtv file using  directshow).</p>
  
  <p>Some of the keys contains the text "thumb", e.g. thumbsize, startthumbdate etc.
  I want to remove all objects from the IDictionary who's keys contain the word thumb.</p>
  
  <p>The only way I'm seeing here is to manually specify each key name using the .Remove method.</p>
  
  <p>Is there some way to get all the objects who's keys contain the word thumb and them remove them from the IDictionary object.</p>
  
  <p>The code looks like this:</p>
  
  <pre><code>IDictionary sourceAttrs = editor.GetAttributes();
  </code></pre>
  
  <p>GetAttributes is defined as:</p>
  
  <pre><code>public abstract IDictionary GetAttributes();
  </code></pre>
  
  <p>I don't have control over GetAttributes, it's returns an IDictionary object, I only know the contents by looking at it while debugging. (likely a HashTable)</p>
  
  <p>UPDATE: Final Answer thanks to Tim:</p>
  
  <pre><code>sourceAttrs = sourceAttrs.Keys.Cast&lt;string&gt;()
                   .Where(key =&gt; key.IndexOf("thumb", StringComparison.CurrentCultureIgnoreCase) == -1)
                   .ToDictionary(key =&gt; key, key =&gt; sourceAttrs[key]);
  </code></pre>