This documentation is archived and is not being maintained.

Compiler Error CS0069

'event': event in interface cannot have add or remove accessors

You cannot define an event's accessor functions in an interface.

The following sample generates CS0069:

// CS0069.cs
using System;
public delegate void EventHandler();

public interface a
{
   event EventHandler Click   // CS0069
   {
      add
      {
      }
      remove
      {
      }
   }
   // remove the preceding EventHandler block
   // try the following line instead
   // event EventHandler Click;
}

public class Class1
{
   public static void Main()
   {
   }
}
Show: