Show / Hide Table of Contents

Class Disposable

Provides implementation of dispose pattern.

Inheritance
Object
Disposable
MemoryWriter<T>
SparseBufferWriter<T>
ConsensusOnlyState
PersistentState
PersistentState.SnapshotBuilder
RaftCluster<TMember>
RaftClusterMember
Implements
IDisposable
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: DotNext
Assembly: DotNext.dll
Syntax
[BeforeFieldInit(true)]
public abstract class Disposable : IDisposable

Properties

| Improve this Doc View Source

DisposedTask

Gets a task representing ObjectDisposedException exception.

Declaration
protected Task DisposedTask { get; }
Property Value
Type Description
Task
| Improve this Doc View Source

IsDisposed

Indicates that this object is disposed.

Declaration
protected bool IsDisposed { get; }
Property Value
Type Description
Boolean

Methods

| Improve this Doc View Source

Dispose()

Releases all resources associated with this object.

Declaration
public void Dispose()
| Improve this Doc View Source

Dispose(Boolean)

Releases managed and unmanaged resources associated with this object.

Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type Name Description
Boolean disposing

true if called from Dispose(); false if called from finalizer Finalize().

| Improve this Doc View Source

Dispose(IEnumerable<IDisposable>)

Disposes many objects.

Declaration
public static void Dispose(IEnumerable<IDisposable> objects)
Parameters
Type Name Description
IEnumerable<IDisposable> objects

An array of objects to dispose.

| Improve this Doc View Source

Dispose(IDisposable[])

Disposes many objects in safe manner.

Declaration
public static void Dispose(params IDisposable[] objects)
Parameters
Type Name Description
IDisposable[] objects

An array of objects to dispose.

| Improve this Doc View Source

DisposeAsync(IEnumerable<IAsyncDisposable>)

Disposes many objects.

Declaration
public static ValueTask DisposeAsync(IEnumerable<IAsyncDisposable> objects)
Parameters
Type Name Description
IEnumerable<IAsyncDisposable> objects

An array of objects to dispose.

Returns
Type Description
ValueTask

The task representing asynchronous execution of this method.

| Improve this Doc View Source

DisposeAsync(IAsyncDisposable[])

Disposes many objects in safe manner.

Declaration
public static ValueTask DisposeAsync(params IAsyncDisposable[] objects)
Parameters
Type Name Description
IAsyncDisposable[] objects

An array of objects to dispose.

Returns
Type Description
ValueTask

The task representing asynchronous execution of this method.

| Improve this Doc View Source

Finalize()

Finalizes this object.

Declaration
protected void Finalize()
| Improve this Doc View Source

GetDisposedTask<T>()

Returns a task representing ObjectDisposedException exception.

Declaration
protected Task<T> GetDisposedTask<T>()
Returns
Type Description
Task<T>

The task representing ObjectDisposedException exception.

Type Parameters
Name Description
T

The type of the task.

| Improve this Doc View Source

QueueDispose(IDisposable)

Places Dispose() method call into thread pool.

Declaration
protected static void QueueDispose(IDisposable resource)
Parameters
Type Name Description
IDisposable resource

The resource to be disposed.

Exceptions
Type Condition
ArgumentNullException

resource is null.

| Improve this Doc View Source

ThrowIfDisposed()

Throws exception if this object is disposed.

Declaration
protected void ThrowIfDisposed()
Exceptions
Type Condition
ObjectDisposedException

Object is disposed.

| Improve this Doc View Source

TrySetDisposedException<T>(TaskCompletionSource<T>)

Attempts to complete the task with ObjectDisposedException exception.

Declaration
protected bool TrySetDisposedException<T>(TaskCompletionSource<T> source)
Parameters
Type Name Description
TaskCompletionSource<T> source

The task completion source.

Returns
Type Description
Boolean

true if operation was successful; otherwise, false.

Type Parameters
Name Description
T

The type of the task.

Implements

System.IDisposable

Extension Methods

AsyncLockAcquisition.AcquireLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireUpgradeableReadLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireUpgradeableReadLockAsync<T>(T, CancellationToken)
ObjectExtensions.GetUserData<T>(T)
ObjectExtensions.IsOneOf<T>(T, IEnumerable<T>)
ObjectExtensions.IsOneOf<T>(T, T[])
ObjectExtensions.Decompose<T, TResult1, TResult2>(T, Func<T, TResult1>, Func<T, TResult2>, out TResult1, out TResult2)
ObjectExtensions.Decompose<T, TResult1, TResult2>(T, ValueFunc<T, TResult1>, ValueFunc<T, TResult2>, out TResult1, out TResult2)
ObjectExtensions.Decompose<T, TResult1, TResult2>(T, Func<T, TResult1>, Func<T, TResult2>)
ObjectExtensions.Decompose<T, TResult1, TResult2>(T, ValueFunc<T, TResult1>, ValueFunc<T, TResult2>)
ObjectExtensions.As<T>(T)
LockAcquisition.AcquireReadLock<T>(T)
LockAcquisition.AcquireReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireWriteLock<T>(T)
LockAcquisition.AcquireWriteLock<T>(T, TimeSpan)
LockAcquisition.AcquireUpgradeableReadLock<T>(T)
LockAcquisition.AcquireUpgradeableReadLock<T>(T, TimeSpan)
ExpressionBuilder.Const<T>(T)

See Also

Implementing Dispose method
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX