Compiler Error C3727

 

For the latest documentation on Visual Studio 2017, see Visual Studio 2017 Documentation.

'event': a managed event must be a member function or a data member that is a pointer to a delegate

.NET events must be a pointer to a delegate type.

The following sample generates C3727:

// C3727.cpp  
// compile with: /clr:oldSyntax  
#using <mscorlib.dll>  
  
__gc class PseudoDelegate  
{  
};  
  
// use the following declaration to resolve the error.  
// __delegate void PseudoDelegate(int);  
  
__gc class MyAttr  
{  
   __event PseudoDelegate* MyE;  
};   // C3727  
  
int main()  
{  
}  

Show: