编译器错误 C3910

“event”:必须定义成员“method”

定义了事件,但不包含指定的必需访问器方法。

有关详细信息,请参阅事件

以下示例生成 C3910:

// C3910.cpp
// compile with: /clr /c
delegate void H();
ref class X {
   event H^ E {
      // uncomment the following lines
      // void add(H^) {}
      // void remove( H^ h ) {}
      // void raise( ) {}
   };   // C3910

   event H^ E2; // OK data member
};