using System; namespace WebDAVSharp.Server { /// /// This abstract base class implements the pattern in a reusable way. /// public abstract class WebDavDisposableBase : IDisposable { private bool _isDisposed; /// /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// public void Dispose() { Dispose(true); GC.SuppressFinalize(this); _isDisposed = true; } /// /// This method will ensure that the object has not been disposed of through a call /// to /// , and if it has, it will throw /// /// /// The object has been disposed of. protected void EnsureNotDisposed() { if (_isDisposed) throw new ObjectDisposedException(GetType().FullName); } /// /// Releases unmanaged and - optionally - managed resources /// /// true to release both managed and unmanaged resources; false to release only unmanaged resources. protected abstract void Dispose(bool disposing); } }