Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it a good style in .NET to create destructors?

Status
Not open for further replies.

vladibo

Programmer
Sep 14, 2003
161
CA
I have classes that contain other classes and containers of classes (ArrayList, Hashtable). Well I know that GC will destroy them all but is it a good style in .NET to create destructors? And will it improve even a little bit the process of destoying objects?
 
I don't think so. Moreover, I think it is a bit dangerous. For example, if you in destructor close a dataabse connection. In my opinion releasing methods should be called explicitly, for example db.disconnect instead of implicitly disconnect from the destructor.

Ion Filipski
1c.bmp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top