Some of you have seen the Disposable base class before. If not, here it is again:
public abstract class Disposable : IDisposable
{
private bool disposed;
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
public bool Disposed
{
get { return disposed; }
}
protected void Dispose(bool disposing)
{
if (!Disposed)
{
if (disposing)
{
DisposeManagedResources();
}
DisposeUnmanagedResources();
disposed = true;
}
}
protected void ThrowExceptionIfDisposed()
{
if (Disposed)
{
throw new ObjectDisposedException(GetType().FullName);
}
}
protected abstract void DisposeManagedResources();
protected virtual void DisposeUnmanagedResources() { }
}
Notice the 'Disposed' property.
One of my coworkers has a class which inherits from this, and he wants to have a 'Disposed' event, which would be triggered after the instance was disposed.
So now, we are wondering if the 'Disposed' name is better for this property, or for the event. We're not sure which would be more suitable. Thoughts and/or alternatives?
Pingback: The Inquisitive Coder - Davy Brion’s Blog » Blog Archive » Help Us Name This Method