title: Clearing or checking for event handlers in C#
body: <p>I have some C# code that updates some properties of an object. I have an event handler defined to help me respond when the update process is done. Unfortunately, I've learned that this event is getting fired multiple times. I suspect this is happening because the event handler is being set at the wrong time. Currently, it is being set like the following: </p>
  
  <pre><code>myObject.Update_Succeeded += new EventHandler(myObject_Update_Succeeded);
  </code></pre>
  
  <p>Due to the complexity of the code, I'm having a difficult time of tracking down where it <em>should</em> be set. I would like to only set the event handler it hasn't been previously set. Because of this, I want to do something like this:</p>
  
  <pre><code>ClearEventHandlers(myObject);
  </code></pre>
  
  <p>or</p>
  
  <pre><code>myObject.Update_Succeeded = null;
  myObject.Update_Succeeded += new EventHandler(myObject_Update_Succeeded);
  </code></pre>
  
  <p>Is there a way to accomplish what I'm trying?</p>
  
  <p>Thank you!</p>