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.
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center