title: Using "contains" to query a list <Key-Value> in C#
body: <p>In my code, I have "sourceElements" is a type of   </p>
  
  <pre><code>List&lt;KeyValuePair&lt;string, string&gt;&gt;.
  </code></pre>
  
  <p>I need to query if the keys of this list contains a particular value and i tried this:</p>
  
  <pre><code>        sourceElements.Add(new KeyValuePair&lt;string, string&gt;("t","t"));
          sourceElements.Add(new KeyValuePair&lt;string, string&gt;("test", "test"));
          sourceElements.Add(new KeyValuePair&lt;string, string&gt;("t1", "t2"));
  
          if (sourceElements.All(x =&gt; x.Key.Contains("test", StringComparer.InvariantCultureIgnoreCase))
          {
               // do some stuff here
          }
  </code></pre>
  
  <p>but the compiler reports "type arguments cannot be inferred from the usage".</p>
  
  <p>any ideas where things are not correct in the code?</p>