DisposableBase

Ecng.Common

Base class with common dispose state management for both sync and async dispose patterns.

Свойства

IsDisposed
public bool IsDisposed { get; }
value = disposableBase.IsDisposed

Gets a value indicating whether this instance is disposed.

IsDisposeStarted
public bool IsDisposeStarted { get; }
value = disposableBase.IsDisposeStarted

Gets a value indicating whether the dispose process has been started.

Методы

DisposeNative
protected virtual void DisposeNative()
disposableBase.DisposeNative()

Disposes the native resources. Override this method to add custom clean up of native resources.

EndDispose
protected void EndDispose()
disposableBase.EndDispose()

Marks the dispose process as complete.

Finalize
protected override void Finalize()
disposableBase.Finalize()

Releases unmanaged resources in the finalizer.

ThrowIfDisposed
protected void ThrowIfDisposed()
disposableBase.ThrowIfDisposed()

Throws an exception if the object is already disposed.

ThrowIfDisposeStarted
protected void ThrowIfDisposeStarted()
disposableBase.ThrowIfDisposeStarted()

Throws an exception if the dispose process has already been started.

TryBeginDispose
protected bool TryBeginDispose()
result = disposableBase.TryBeginDispose()

Tries to begin the dispose process.

Возвращает: true if dispose can proceed; false if already disposing/disposed.

События

Disposed
public event Action Disposed
disposableBase.Disposed += handler

Occurs when the object has been disposed.