相关疑难解决方法(0)

Delegate.CreateDelegate()和泛型:绑定到目标方法的错误

我在使用反射和泛型创建委托集合时遇到问题.

我正在尝试从Ally方法创建一个委托集合,它们共享一个常用的方法签名.

public class Classy
{
  public string FirstMethod<T1, T2>( string id, Func<T1, int, IEnumerable<T2>> del );
  public string SecondMethod<T1, T2>( string id, Func<T1, int, IEnumerable<T2>> del );    
  public string ThirdMethod<T1, T2>( string id, Func<T1, int, IEnumerable<T2>> del );

  // And so on...
}
Run Code Online (Sandbox Code Playgroud)

和仿制药烹饪:

// This is the Classy's shared method signature    
public delegate string classyDelegate<out T1, in T2>( string id, Func<T1, int, IEnumerable<T2>> filter );


// And the linq-way to get the collection of delegates from Classy
( …
Run Code Online (Sandbox Code Playgroud)

.net c# generics delegates exception

9
推荐指数
1
解决办法
7909
查看次数

标签 统计

.net ×1

c# ×1

delegates ×1

exception ×1

generics ×1