title: IEnumerable<T>.ToLookup<TKey, TValue>
body: <p>I am trying to turn an <code>IEnumerable&lt;KeyValuePair&lt;string, object&gt;&gt;</code> into an <code>ILookup&lt;string, object&gt;</code> using the following code:</p>
  
  <pre><code>var list = new List&lt;KeyValuePair&lt;string, object&gt;&gt;()
  {
      new KeyValuePair&lt;string, object&gt;("London", null),
      new KeyValuePair&lt;string, object&gt;("London", null),
      new KeyValuePair&lt;string, object&gt;("London", null),
      new KeyValuePair&lt;string, object&gt;("Sydney", null)
  };
  
  var lookup = list.ToLookup&lt;string, object&gt;(a =&gt; a.Key);
  </code></pre>
  
  <p>But the compiler is complaining with:</p>
  
  <blockquote>
    <p>Instance argument: cannot convert from
    'System.Collections.Generic.List>'
    to
    'System.Collections.Generic.IEnumerable'</p>
  </blockquote>
  
  <p>and</p>
  
  <blockquote>
    <p>'System.Collections.Generic.List>'
    does not contain a definition for 'ToLookup' and the best extension
    method overload
    'System.Linq.Enumerable.ToLookup(System.Collections.Generic.IEnumerable,
    System.Func)' has some invalid arguments</p>
  </blockquote>
  
  <p>and</p>
  
  <blockquote>
    <p>cannot convert from 'lambda expression' to 'System.Func'</p>
  </blockquote>
  
  <p>What am I doing wrong with the lambda expression?</p>