As I have mentioned before, there is a wealth of knowledge to be gained from reading internal Microsoft mailing lists. I plan to share some of that when I get a chance - under the category .NET - Random Tips. Here is one such.

If you have code like this:

private void Foo() {
     MyForm f = new MyForm();

Does f get garbage collected when Foo() returns?

Mark Boulter clarifies:

No, the Form will not be garbage collected until it is closed and disposed.

More on automatic form disposal:

  • Modal Forms (ShowDialog) do not get automatically Disposed on Close.
  • Modeless Forms (Show) get automatically Disposed on Close.