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( ) {}
}
};
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for