If I remove an object from a collection do I have to set it to null first?

  • Thread starter Thread starter Erik
  • Start date Start date
E

Erik

Hi All,

If I add an object to a hashtable for instance, then further down the
line I remove it, do I have to set it to null first before I remove it
or does removing it from the collection automatically put it out of
scope.

Cheers,

Erik
 
No, you don´t have to set it to null. Once all references to it are removed,
the object will be eventually garbage-collected. So, if the collection is
the unique reference to it, once removed that's all.

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com
 
Back
Top