Compiler Error CS0069
TOC
Collapse the table of content
Expand the table of content
The document is archived and information here might be outdated

Compiler Error CS0069

An event in an interface cannot have add or remove accessors

You cannot define an event's accessor functions in an interface. For more information, see Events (C# Programming Guide) and Interfaces (C# Programming Guide).

The following sample generates CS0069:

// CS0069.cs
// compile with: /target:library

public delegate void EventHandler();

public interface a
{
   event EventHandler Click { remove {} }   // CS0069
   event EventHandler Click2;   // OK
}
Show:
© 2016 Microsoft