1
有人可以帮我理清这个编译器错误吗?奇怪的C#编译器错误
我有这样
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'不带'1'参数。
卫生署,为什么我没测试。有效。谢谢 – adrianm