What is the difference between using IDisposable vs a destructor in C#?
Posted
by j0rd4n
on Stack Overflow
See other posts from Stack Overflow
or by j0rd4n
Published on 2008-12-03T23:04:22Z
Indexed on
2010/06/07
18:52 UTC
Read the original article
Hit count: 253
When would I implement IDispose on a class as opposed to a destructor? I read this article, but I'm still missing the point.
My assumption is that if I implement IDispose on an object, I can explicitly 'destruct' it as opposed to waiting for the garbage collector to do it. Is this correct?
Does that mean I should always explicitly call Dispose on an object? What are some common examples of this?
© Stack Overflow or respective owner