Compilerfehler CS0066
Aktualisiert: November 2007
Fehlermeldung
"Ereignis": Das Ereignis muss einen Delegattyp aufweisen.
'event': event must be of a delegate type
Das Schlüsselwort event erfordert einen Delegattyp. Weitere Informationen finden Sie unter Ereignisse (C#-Programmierhandbuch) und unter Delegaten (C#-Programmierhandbuch).
Im folgenden Beispiel wird CS0066 generiert:
// CS0066.cs
using System;
public class EventHandler
{
}
// to fix the error, remove the event declaration and the
// EventHandler class declaration, and uncomment the following line
// public delegate void EventHandler();
public class a
{
public event EventHandler Click; // CS0066
private void TestMethod()
{
if (Click != null)
Click();
}
public static void Main()
{
}
}