abstarct class BaseClass{ private bool _disposed = false protected virtual void Dispose(bool disposing){ if(_disposed){ return; } if(!disposing){ //Free managed objects } //Free any other objects _disposed = true; } }
class ImplClass : BaseClass{ private bool _disposed = false; protected override void Dispose(bool disposing){ if(_disposed){ return; } if(disposing){ //Free managed objects } //Free any other objects _disposed = true; base.Dispose(disposing); } }