Export (0) Print
Expand All
Expand Minimize

Compiler Error CS0071

An explicit interface implementation of an event must use property syntax

When implementing an event that was declared in an interface, you must use property syntax.

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
   /*
   event MyEvent ITest.Clicked
   {
      get
      {
         return null;
      }
      set
      {
      }
   }
   */

   public static void Main()
   {
   }
}
Show:
© 2014 Microsoft