Compiler Error CS0069
TOC
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Compiler Error CS0069 

Error Message

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