We recommend using Visual Studio 2017

Compiler Error C3919

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Compiler Error C3919.

event_method': function must have type 'type'

An event accessor method was not declared correctly.

For more information about events, see event.

The following sample generates C3919:

// C3919.cpp  
// compile with: /clr /c  
using namespace System;  
delegate void D(String^);  
ref class R {  
   event D^ e {  
      int add(int);   // C3919  
      int remove(int);   // C3919  
  
      void add(D^);   // OK  
      void remove(D^);   // OK  
   }  
};  

Show: