Is disposing the same object several times just only stupid, or do it have
some other side effects?
> Is disposing the same object several times just only stupid, or do it have
> some other side effects?
That would depend on its implementation. It shouldn't have side effects if
the methods is carefully designed. Some classes have a "Disposed" property,
but its purpose seems to be to let you find out if you can still use the
object, rather than determining the need to dispose.
But I'd try to avoid it in general.
>Is disposing the same object several times just only stupid, or do it have
>some other side effects?
You should only .Dispose your objects once: when all of the references
are finished. If you .Dispose an object that is still valid and
active, you may well introduce a bug in another part of your program,
which is holding a reference to your object, and expecting it to be in
a known state.
Thus, you really do not want to replace all of your Set obj = Nothing
calls with obj.Dispose. You need to make sure that nobody else is
holding a reference to your object.
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL