Errore del compilatore CS0068
Aggiornamento: novembre 2007
Messaggio di errore
'evento': l'evento nell'interfaccia non può presentare un inizializzatore.
'event': event in interface cannot have initializer
Un evento in un'interfaccia non può includere un inizializzatore. Per ulteriori informazioni, vedere Interfacce (Guida per programmatori C#).
Il seguente codice di esempio genera l'errore CS0068:
// CS0068.cs
delegate void MyDelegate();
interface I
{
event MyDelegate d = new MyDelegate(M.f); // CS0068
// try the following line instead
// event MyDelegate d2;
}
class M
{
event MyDelegate d = new MyDelegate(M.f);
public static void f()
{
}
public static void Main()
{
}
}