Form의 Close() 와 Dispose() 호출.

Form.Close() sends the proper windows messages to shut down the win32 window. During that process, if the form was not shown modally, Dispose is called on the form. Disposing the form frees up the unmanaged resources that the form is holding onto.  

If you do a form1.Show() or Application.Run(new Form1()), Dispose will be called when Close() is called.

However, if you do form1.ShowDialog() to show the form modally, the form will not be disposed, and you'll need to call form1.Dispose() yourself.  I believe this is the only time you should worry about disposing the form yourself.

원문

모달로 열린 Form은 Dispose()를 별도로 호출해줘야 한다.
그러나 대부분의 경우 Dispose는 GC가 신경쓸 일이지, 우리가 신경쓸 일은 아님.

댓글

이 블로그의 인기 게시물

Oracle NLS_DATE_FORMAT 변경

Stop console process using Ctrl+C.

Alternative to IValueConvert, QuickConverter