Groups | Blog | Home
all groups > c# > may 2004 >

c# : do the .net release the resources in my app ?


¹ùÑÇ·æ
5/31/2004 10:09:27 PM
i am newer to c# programming.
i found most of the example of database accessing do not mention that
whether the system release all the resources such as sqlconnection,
sqldataadapter.

and i made a program that use Application.Exit() method to quit the
program.Can you tell me dose it can couse some problems such as memory leak
etc ?

Thank you !

Kristof Despiere
6/1/2004 9:45:11 AM
Make sure you always close your SQLConnection from the moment you don't need
it anymore Application.Exit(). Eventually it will be disposed on
Application.Exit() but it's better you close it yourself. Don't worry about
other objects, the garbage collector will take care of it. You could even
play a bit with System.GC.Collect() just before calling Application.Exit(),
but i won't be necessary.

Kristof

[quoted text, click to view]

AddThis Social Bookmark Button