Let's say I have some component like this:
class SomeForm : Form
{
private Control example;
public void Stuff()
{
this.example = new ComboBox();
// ...
this.Controls.Add(example);
}
public void OtherStuff()
{
this.Controls.Remove(example);
}
}
Who is responsible for calling Dispose
on the example control? Does removing it from this.Controls
cause it to be disposed? Or does this leak bunches of window handles backing the controls?
(For reference, I'm asking this because I don't see where the Windows Forms Designer generates code to call Dispose on a Form's children)