【发布时间】:2009-11-14 14:34:43
【问题描述】:
谁能帮我解决这个编译器错误?
我有这样的课
public class Test {
public delegate void TestAction<T>(T arg);
public delegate void TestActionCaller<T1, T2>(T1 arg, TestAction<T2> action);
public static void Call<T1,T2>(TestActionCaller<T1,T2> actioncaller) {
actioncaller(default(T1), arg => { });
}
}
然后我有以下代码
public class TestCaller {
static TestCaller() {
Test.Call<int, int>((arg,action)=>action(arg));
}
}
这很好用。
但是,如果我将 TestCaller 移动到另一个程序集(与上面的代码完全相同),我会收到编译器错误“Delegate 'TestAction' does not take '1' arguments。”
【问题讨论】:
标签: c# compiler-errors