IDisposableBase.cs 399 B

123456789101112131415161718192021222324
  1. using System;
  2. public abstract class IDisposableBase : IDisposable
  3. {
  4. public virtual void Dispose()
  5. {
  6. this.Dispose(true);
  7. GC.SuppressFinalize(this);
  8. }
  9. protected virtual void Dispose(bool is_release_managed_code)
  10. {
  11. if (this.is_disposed_)
  12. {
  13. return;
  14. }
  15. this.DisposeEvent();
  16. this.is_disposed_ = true;
  17. }
  18. protected abstract void DisposeEvent();
  19. protected bool is_disposed_;
  20. }