Compiler Error CS0066
TOC
Collapse the table of content
Expand the table of content
This documentation is archived and is not being maintained.

Compiler Error CS0066 

Error Message

'event': event must be of a delegate type

The event keyword requires a delegate type. For more information, see Events (C# Programming Guide) and Delegates (C# Programming Guide).

The following sample generates CS0066:

// 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()
   {
   }
}
Show:
© 2016 Microsoft