On 2003-11-24, Ivan Weiss <iv*****@optonline.net> wrote:
So in my case since I am declaring a local variable to an object of the
type Database (a class created by me) I do not need to worry about
setting it equal to nothing or any type of dispose method?
That depends on what your Database class contains. If for instance, if
it has references to other disposable objects, such as database
connections, then you will probably want to implement IDisposable.
Does this mean once the function is finished the variable is released
for garbage collection? Also when I close a form does this implicitly
free all variables objects created within that form for garbage
collection?
The object is availabe for GC, as long as there are no other references.
You do understand though that GC is a non-deterministic process. In
other words, you can't be sure when it will run. Going out of scope
makes the object available for collection, but does not guarentee that
the object is going to be immediately collected.
--
Tom Shelton
MVP [Visual Basic]