NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Compiler Error CS0070

The event 'event' can only appear on the left hand side of += or -= (except when used from within the class it is defined in)

Outside of the class it is defined in, an event can only add or subtract references.

The following sample generates CS0070:

using System;
public delegate void EventHandler();

public class A {

   public event EventHandler Click {
      get {
         return null;
      }
      set {
      }
   }

   public static void OnClick() {
      EventHandler eh;
      A a = new A();
      eh = a.Click;
   }


   public static void Main() {
   }
}

public class B {
   public int mf () {
      EventHandler eh = new EventHandler(A.OnClick);
      A a = new A();
      eh = a.Click;   // CS0070
      // try the following line instead
      // a.Click += eh;
      return 1;
   }
}