Compiler Error C3909
aWinRT or managed event declaration must occur in a WinRT or managed type
A Windows Runtime event or managed event was declared in a native type. To fix this error, declare events in Windows Runtime types or managed types.
For more information, see event.
The following sample generates C3909 and shows how to fix it:
// C3909.cpp
// compile with: /clr /c
delegate void H();
class X {
event H^ E; // C3909 - use ref class X instead
};
ref class Y {
static event H^ E {
void add(H^) {}
void remove( H^ h ) {}
void raise( ) {}
}
};