public class Disposable : IDisposable
{
private bool disposed = false;
protected virtual void Dispose(bool disposing)
{
if (this.disposed)
{
return;
}
if (disposing)
{
// Managed リソースの破棄処理
}
// Unmanaged リソースの破棄処理
this.disposed = true;
}
public void Dispose()
{
this.Dispose(true);
GC.SuppressFinalize(this);
}
~Disposable()
{
this.Dispose(false);
}
}