编译器错误 CS1678
更新:2007 年 11 月
错误消息
参数“number”被声明为类型“type1”,但应为“type2”
当匿名方法中的参数类型与您要将方法强制转换为的委托的声明不同时,将出现此错误。
下面的示例生成 CS1678:
// CS1678
delegate void D(int i);
class Errors
{
static void Main()
{
D d = delegate(string s) { }; // CS1678
// To resolve, use the following line instead:
// D d = delegate(int s) { };
}
}