Condividi tramite


Errore del compilatore C3909

Una dichiarazione di evento WinRT o gestito deve verificarsi in un tipo WinRT o gestito

Osservazioni:

Un evento Windows Runtime o gestito è stato dichiarato in un tipo nativo. Per correggere l'errore, dichiarare gli eventi nei tipi Windows Runtime o nei tipi gestiti.

Per altre informazioni, vedere evento.

Example

L'esempio seguente genera l'errore C3909 e mostra come risolverlo:

// 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( ) {}
   }
};