Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

Compiler Error CS0071

An explicit interface implementation of an event must use event accessor syntax

When explicitly implementing an event that was declared in an interface, you must use manually provide the add and remove event accessors that are typically provided by the compiler. The accessor code can connect the interface event to another event in your class (shown later in this topic), or to its own delegate type. For more information, see How to: Implement Interface Events (C# Programming Guide).

The following sample generates CS0071.

// CS0071.cs
public delegate void MyEvent(object sender);

interface ITest
    event MyEvent Clicked;

class Test : Itest
    event MyEvent ITest.Clicked;  // CS0071

    // try the following code instead
private MyEvent clicked;

    event MyEvent Itest.Clicked
            clicked += value;
            clicked -= value;
    public static void Main() { }
© 2015 Microsoft