title: elegant way of clearing an events
body: <p>i am implementing  a Buthon_Click Method, which as the name suggests is being used with an event onclick button.Now in order this method to do what i want i need to clear/unbind/unsubscribe the delegate attached to the <code>SystemEvents.SessionSwitch</code> event.The problem is that i want to do this without caring which method has been hooked up before.
  For an example:</p>
  
  <pre><code>SystemEvents.SessionSwitch += new SessionSwitchEventHandler(Methodx);
  </code></pre>
  
  <p>So what i am doing now is creating a foreach and going through all possibilities - 4 overall:</p>
  
  <pre><code>int [] array={1,2,3,4};
  
  
  foreach (int n in array)
  {
      SystemEvents.SessionSwitch -= new SessionSwitchEventHandler(SystemEvents_SessionSwitch1);
      SystemEvents.SessionSwitch -= new SessionSwitchEventHandler(SystemEvents_SessionSwitch2);
      SystemEvents.SessionSwitch -= new SessionSwitchEventHandler(SystemEvents_SessionSwitch3);
      SystemEvents.SessionSwitch -= new SessionSwitchEventHandler(SystemEvents_SessionSwitch4);
  }
  </code></pre>
  
  <p>i find this peace of code a bit cumbersome and awkward , and i was wondering if there is a more "elegant" way of doing this something like just <code>SystemEvents.SessionSwitch == null</code> or similar which would wipe out all methods hooked up ?</p>
  
  <p>Thanks in advance </p>