Proper way to dispose a new Form

前端 未结 4 2061
囚心锁ツ
囚心锁ツ 2020-11-27 22:15

So in my apps, I tend to create new instances of forms on the fly, then use Form.Show() to display them (non modal).



        
4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-27 23:12

    So according to the answer over at MSDN, non modal forms are automatically Disposed whenever you close them.

    I decided to test this by opening my test form multiple times and closing them. I even opened multiple instances at the same time. After a second or two, the memory used by these forms were reclaimed, which would indicate that they were being disposed properly.

提交回复
热议问题