title: Delegate.CreateDelegate() and generics: Error binding to target method
body: <p>I'm having problems creating a collection of delegate using reflection and generics.</p>
  
  <p>I'm trying to create a delegate collection from Ally methods, whose share a common method signature.</p>
  
  <pre><code>public class Classy
  {
    public string FirstMethod&lt;T1, T2&gt;( string id, Func&lt;T1, int, IEnumerable&lt;T2&gt;&gt; del );
    public string SecondMethod&lt;T1, T2&gt;( string id, Func&lt;T1, int, IEnumerable&lt;T2&gt;&gt; del );    
    public string ThirdMethod&lt;T1, T2&gt;( string id, Func&lt;T1, int, IEnumerable&lt;T2&gt;&gt; del );
  
    // And so on...
  }
  </code></pre>
  
  <p>And the generics cooking:</p>
  
  <pre><code>// This is the Classy's shared method signature    
  public delegate string classyDelegate&lt;out T1, in T2&gt;( string id, Func&lt;T1, int, IEnumerable&lt;T2&gt;&gt; filter );
  
  
  // And the linq-way to get the collection of delegates from Classy
  ( 
     from method in typeof( Classy ).GetMethods( BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.NonPublic )
     let delegateType = typeof( classyDelegate&lt;,&gt; )
     select Delegate.CreateDelegate( delegateType, method )
  ).ToList( );
  </code></pre>
  
  <p>But the <code>Delegate.CreateDelegate( delegateType, method )</code> throws an ArgumentException saying Error binding to target method. : /</p>
  
  <p>What am I doing wrong?</p>