do the .net release the resources in my app ?

  • Thread starter Thread starter ¹ùÑÇ·æ
  • Start date Start date
¹

¹ùÑÇ·æ

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 !
 
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
 
Back
Top