Recent Posts
Calendar
November 2013
S M T W T F S
« Oct    
 12
3456789
10111213141516
17181920212223
24252627282930

Posts Tagged ‘dispose’

Dispose, Finalize and SuppressFinalize

food-drk-017

I got the following question recently.

What is the difference between Dispose and
SupressFinalize in garbage collection?”

The problem with this question is it assumes Dispose and SupressFinalize have similarities, which I’m sure is not what is being asked here.  So let’s rephrase it in terms that make sense.

I see three methods available to me in .NET that all seem to have something to do with garbage collection.  Can you explain what Dispose, Finalize, and SupressFinalize do and why I could use or call each one in my code?”

Read the rest of this entry »

Dispose with Using

misc_vol3_087 I’m sure that many of you already know that many of the objects in the .NET framework need to be disposed.  The most common of these are the windows objects and the stream objects.

Of course the trick in using dispose is in calling it at the right time.  If your code throws an exception, you need to make sure that dispose still gets called on that object.

Read the rest of this entry »