Compiler Error CS0070

The event 'event' can only appear on the left hand side of += or -= (except when used from within the type 'type')

Outside of the class it is defined in, an event can only add or subtract references. For more information, see Events.

The following sample generates CS0070:

// CS0070.cs  
using System;  
public delegate void EventHandler();  
  
public class A  
{  
   public event EventHandler Click;  
  
   public static void OnClick()  
   {  
      EventHandler eh;  
      A a = new A();  
      eh = a.Click;  
   }  
  
   public static void Main()  
   {  
   }  
}  
  
public class B  
{  
   public int Foo ()  
   {  
      EventHandler eh = new EventHandler(A.OnClick);  
      A a = new A();  
      eh = a.Click;   // CS0070  
      // try the following line instead  
      // a.Click += eh;  
      return 1;  
   }  
}