With WinForms, which method is more efficient, close and reload or hide/show?
When working with Windows forms in C#, is it safer/more beneficial
resource-wise to completely close the form each time and reload the
data when you need the form again, as opposed to just hiding the form
and keeping it all in memory?
Jan MontanoPosted Mar 19, 2009, 9:26 PM
With the hardware these days, loading times for winapp forms are really fast. And think for example if you have 100 forms, it will really be troublesome if all those forms were only hidden and not closed. It will really eat up a lot.
Just my two cents.
Mahesh ChandPosted Mar 19, 2009, 7:42 PM
StefanPosted Mar 19, 2009, 5:40 PM
Try it out.
Start your app and open task manager. Watch your memory usage. Now hide a form and notice the memory usage again.
Now do the same thing, but close the form instead.