Table of Contents

Class Disposable

Namespace
Ecng.Common
Assembly
Ecng.Common.dll

Provides a base class for implementing the dispose pattern. This class helps manage the disposal of managed and native resources.

public abstract class Disposable : IDisposable
Inheritance
Disposable
Implements
Derived
Inherited Members
Extension Methods

Constructors

Disposable()

protected Disposable()

Properties

IsDisposeStarted

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

[Browsable(false)]
public bool IsDisposeStarted { get; }

Property Value

bool

true if the dispose process has been initiated; otherwise, false.

IsDisposed

Gets a value indicating whether this instance is disposed.

[Browsable(false)]
public bool IsDisposed { get; }

Property Value

bool

true if this instance is disposed; otherwise, false.

Methods

Dispose()

Performs tasks associated with freeing, releasing, or resetting unmanaged resources.

public virtual void Dispose()

DisposeManaged()

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

protected virtual void DisposeManaged()

DisposeNative()

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

protected virtual void DisposeNative()

~Disposable()

Releases unmanaged resources and performs other cleanup operations before the object is reclaimed by garbage collection.

protected ~Disposable()

ThrowIfDisposeStarted()

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

protected void ThrowIfDisposeStarted()

Exceptions

ObjectDisposedException

Thrown if the dispose process has already been initiated.

ThrowIfDisposed()

Throws an exception if the object is already disposed.

protected void ThrowIfDisposed()

Exceptions

ObjectDisposedException

Thrown if the object is already disposed.

Events

Disposed

Occurs when the object has been disposed.

public event Action Disposed

Event Type

Action