Iris Classon
Iris Classon - In Love with Code

Stupid Question 97: What is the difference between close and dispose in Net?

Recorded at 32m, Shark Point- Phuket Thailand.

In most .Net classes there isn’t any difference between close and dispose, besides the name. In WinRT they are always identical, while in general in .Net there are just a few exceptions such as database connections where close just closes the connection (and can later be reopened) and System.Windows.Forms.Form.

Comments

Leave a comment below, or by email.
Henrik
12/8/2012 5:38:00 AM
Dispose usually comes from deriving from IDisposable. Thus you can use "using" in C#.
Dispose almost always calls Close() behind the scene. 


Last modified on 2012-12-05

comments powered by Disqus