Compiler Error CS0068

'event': event in interface cannot have initializer

An event in an interface cannot have an initializer. For more information, see Interfaces (C# Programming Guide).

The following sample generates 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()
   {
   }
}