title: Invoke Enumerable.Where (or other overloaded generic method) using reflection
body: <p>There are 2 overloads (or method signatures) of the "Where" method in Enumerable class:</p>
  
  <pre><code>namespace System.Linq {
      public static class Enumerable {
          public static IEnumerable&lt;TSource&gt; Where&lt;TSource&gt;(this IEnumerable&lt;TSource&gt; source, Func&lt;TSource, bool&gt; predicate);
          public static IEnumerable&lt;TSource&gt; Where&lt;TSource&gt;(this IEnumerable&lt;TSource&gt; source, Func&lt;TSource, int, bool&gt; predicate);
      }
  </code></pre>
  
  <p>So</p>
  
  <pre><code>var where = typeof(Enumerable).GetMethod("Where") 
  </code></pre>
  
  <p>throws an exception stating  an ambiguous match because, of course, there is more than one method with the name "Where", so I tried to differentiate by the parameters:</p>
  
  <pre><code>var types = new[] { 
      typeof(IEnumerable&lt;&gt;), 
      typeof(Func&lt;,&gt;)};
  var where = typeof(Enumerable).GetMethod("Where", types);
  </code></pre>
  
  <p>This however doesn't match either of the method signatures, and I'm not sure why.</p>
  
  <p>Generalized question: How do you invoke an overloaded generic method via reflection without iterating over all the methods in the class w/ the same name (i.e., using System.Type.GetMethod(System.String, System.Type[])?</p>
  
  <p>Please help me fix it! Thanks!</p>