title: C# - Removing event handlers - FormClosing event or Dispose() method
body: <p>Suppose I have a form opened via the .ShowDialog() method.</p>
  
  <p>At some point I attach some event handlers to some controls on the form.</p>
  
  <p>e.g.</p>
  
  <pre><code>// Attach radio button event handlers.
  this.rbLevel1.Click += new EventHandler(this.RadioButton_CheckedChanged);
  this.rbLevel2.Click += new EventHandler(this.RadioButton_CheckedChanged);
  this.rbLevel3.Click += new EventHandler(this.RadioButton_CheckedChanged);
  </code></pre>
  
  <p>When the form closes, I need to remove these handlers, right?</p>
  
  <p>At present, I am doing this when the FormClosing event is fired.</p>
  
  <p>e.g.</p>
  
  <pre><code>private void Foo_FormClosing(object sender, FormClosingEventArgs e)
  {
      // Detach radio button event handlers.
      this.rbLevel1.Click -= new EventHandler(this.RadioButton_CheckedChanged);
      this.rbLevel2.Click -= new EventHandler(this.RadioButton_CheckedChanged);
      this.rbLevel3.Click -= new EventHandler(this.RadioButton_CheckedChanged);
  }
  </code></pre>
  
  <p>However, I have seen some examples where handlers are removed in the Dispose() method.</p>
  
  <p>Is there a 'best-practice' way of doing this?</p>
  
  <p>(Using C#, Winforms, .NET 2.0)</p>
  
  <p>Thanks.</p>