G
Gale Green
Hi all.
I'm a recent migrant from VB6 so I'm used to creating references to
objects and then setting them to Nothing when they are no longer
needed.
Do I understand correctly that setting to Nothing is unnecessary in VB
2008 when the owning class or form is about to close anyway?
Can disposal of objects always be left to the garbage collector, or
are there times when setting to Nothing would be useful or desirable?
Second, though related, question: when showing a form, using
..ShowDialog, I always call the form's .Dispose method on return.
Should I set the form to Nothing as well? Everything seems to work
whether I set to Nothing or not, but I can't tell whether resources
are being retained unnecessarily.
Thanks for any guidance.
Gale.
I'm a recent migrant from VB6 so I'm used to creating references to
objects and then setting them to Nothing when they are no longer
needed.
Do I understand correctly that setting to Nothing is unnecessary in VB
2008 when the owning class or form is about to close anyway?
Can disposal of objects always be left to the garbage collector, or
are there times when setting to Nothing would be useful or desirable?
Second, though related, question: when showing a form, using
..ShowDialog, I always call the form's .Dispose method on return.
Should I set the form to Nothing as well? Everything seems to work
whether I set to Nothing or not, but I can't tell whether resources
are being retained unnecessarily.
Thanks for any guidance.
Gale.