using System;
namespace WebDAVSharp.Server
{
///
/// This abstract base class implements the pattern in a reusable way.
///
public abstract class WebDavDisposableBase : IDisposable
{
#region Properties
private bool _isDisposed;
#endregion
#region Abstract Functions
///
/// 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);
#endregion
#region Functions
///
/// 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);
}
#endregion
}
}