51 lines
1.1 KiB
C#
51 lines
1.1 KiB
C#
using System;
|
|
using JD.Kernel.Interfaces;
|
|
|
|
namespace JD.Kernel.Classes
|
|
{
|
|
/// <summary>
|
|
/// Base class for <see cref="IDisposable"/> objects.
|
|
/// </summary>
|
|
public class AbstractDisposable : IDisposable, IIsDisposed
|
|
{
|
|
#region Variables
|
|
|
|
private bool m_isDisposed;
|
|
|
|
#endregion
|
|
|
|
#region Methods
|
|
|
|
/// <summary>
|
|
/// Disposes this object.
|
|
/// </summary>
|
|
public void Dispose()
|
|
{
|
|
if (!m_isDisposed)
|
|
{
|
|
m_isDisposed = true;
|
|
Dispose(true);
|
|
}
|
|
}
|
|
|
|
protected virtual void Dispose(bool disposing)
|
|
{
|
|
// The parameter is obsolete but it has the nice side-effect
|
|
// that the signature is different from IDisposable.Dispose.
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Properties
|
|
|
|
/// <summary>
|
|
/// Has this object been disposed?
|
|
/// </summary>
|
|
public bool IsDisposed
|
|
{
|
|
get { return m_isDisposed; }
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|