No, you don´t need to implement the dispose method in that case.
- If a class has a Dispose method, you need to call it when you are done
with it. For example, if the objects that you store in the collection have
the Dispose method and the collection is the only reference to them, you
should dispose them before removing them from the collection.
- You only need to implement a Dispose method in your class when it wraps an
unmaneged resource, such as a Win32 handle, or a managed object that has a
Dispose method that your class don´t call automatically internally.
--
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
"gmccallum" <gm*******@discussions.microsoft.com> escribió en el mensaje
news:0C**********************************@microsof t.com...
This whole dispose topic confuses me regarding managed and unmanaged
resources. I think that it was easier when you just cleaned up every
object,
which brings me to my problem.
I have some classes that have Hashtables collections defined as class
variables.
In the past, when I was done with the class, I would remove all the items
from the collection and then set the collection to null.
In C# (.NET General), is this necessary anymore? For example, do I need
to
implement a dispose method that would remove all the items from the
collection and set the collection to null. Is it enough to just set the
class instance to null and everything inside would be cleaned up?
Thanks in advance.
Greg