I've read (on using
Statement (C# Reference)) that the using
statement should be used to release the resources used by managed types (like File and Font) that use unmanaged resources. So started using it with MySql classes and related stuff, but if you take a look at an object of a Windows.Forms.Form class you will see a Dispose method, it means that this class implements IDisposable so, should I use a using
statement for a Windows.Forms.Form object like in the case below?
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
{
using (AboutBoxProjeto about = new AboutBoxProjeto())
{
about.ShowDialog();
}
}
Form
displayed withShowDialog
is a memory leak. – Ginosaji May 17 '13 at 13:31