Possible Duplicate:
Am I implementing IDisposable correctly?
Hi,
I am referring this post to check the use of IDisposable.
I see an issue in Dispose method here. In the code "disposed" is used only in the
private void Dispose(bool disposing)
method.
I believe it should be used before calling the "Dipose" method and correct implementation would be
public void Dispose()
{
if(!disposed )
{
Dispose(true);
// This object will be cleaned up by the Dispose method.
// Therefore, you should call GC.SupressFinalize to
// take this object off the finalization queue
// and prevent finalization code for this object
// from executing a second time.
GC.SuppressFinalize(this);
}
}
Am I thinking correct?