编译器错误 CS0065
更新:2007 年 11 月
错误消息
“event”:事件属性必须同时具有 add 访问器和 remove 访问器
不是字段的事件必须具有两种访问方法。
下面的示例生成 CS0065:
// CS0065.cs
using System;
public delegate void Eventhandler(object sender, int e);
public class MyClass
{
public event EventHandler Click // CS0065,
{
// to fix, uncomment the add and remove definitions
/*
add
{
Click += value;
}
remove
{
Click -= value;
}
*/
}
public static void Main()
{
}
}