[dba-VB] C#: When to Dispose

Charlotte Foust cfoust at infostatsystems.com
Mon Aug 25 18:15:39 CDT 2008


It was more important in earlier version of VS because the garbage
collection wasn't as good as the current versions.  If you do dispose an
object, make sure you aren't going to need it again in a minute, because
it's gone!

Charlotte Foust 

-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: Friday, August 22, 2008 9:27 AM
To: dba-vb at databaseadvisors.com
Subject: [dba-VB] C#: When to Dispose

Hi all

Came across this article on the subject:

  http://www.devx.com/dotnet/Article/33167

and realise that I don't dispose objects that much and yet the code runs
- and most of the coding examples I see don't tell much about it.

Right now I'm writing some code to send a series of e-mails and the code
I found calls Dispose. That makes sense: Create the MailMessage object,
send the message, dispose object.

But what experience do you have? How keen are you about disposing
objects?

/gustav


_______________________________________________
dba-VB mailing list
dba-VB at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vb
http://www.databaseadvisors.com





More information about the dba-VB mailing list