title: In C#, why can't I test if a event handler is null anywhere outside of the class that it's defined?
body: <p>I am sure that I am just not understanding something fundamental about events and/or delegates in C#, but why can't I do the Boolean tests in this code sample:</p>
  
  <pre><code>public class UseSomeEventBase {
      public delegate void SomeEventHandler(object sender, EventArgs e);
      public event SomeEventHandler SomeEvent;
      protected void OnSomeEvent(EventArgs e) {
          // CANONICAL WAY TO TEST EVENT. OF COURSE, THIS WORKS.
          if (SomeEvent != null) SomeEvent(this, e);
      }
  }
  
  public class UseSomeEvent : UseSomeEventBase {
      public bool IsSomeEventHandlerNull() {
          // "LEFT HAND SIDE" COMPILER ERROR
          return SomeEvent == null;
      }
  }
  
  class Program {
      static void Main(string[] args) {
          var useSomeEvent = new UseSomeEvent();
          useSomeEvent.SomeEvent +=new UseSomeEventBase.SomeEventHandler(FuncToHandle);
          // "LEFT HAND SIDE" COMPILER ERROR
          if (useSomeEvent.SomeEvent == null) {
  
          }
          var useSomeEventBase = new UseSomeEventBase();
          useSomeEventBase.SomeEvent += new UseSomeEventBase.SomeEventHandler(FuncToHandle);
          // "LEFT HAND SIDE" COMPILER ERROR
          if (useSomeEventBase.SomeEvent == null) {
  
          }
      }
  
      static void FuncToHandle(object sender, EventArgs e) { }
  }
  </code></pre>