Class DisposeByRefObject

Manages object lifetime by refence counting.

Inheritance
System.Object
Disposable
DisposeByRefObject
Implements
IDisposableEx
System.IDisposable
System.IAsyncDisposable
Inherited Members
Disposable.CheckNotDisposed()
Disposable.Dispose()
Disposable.DisposeAsync()
Disposable.Disposed
Disposable.Disposing
Namespace: Solti.Utils.Primitives.Patterns
Assembly: Solti.Utils.Primitives.dll
Syntax
public class DisposeByRefObject : Disposable, IDisposableEx

Constructors

DisposeByRefObject()

Declaration
public DisposeByRefObject()

Properties

RefCount

The current reference count.

Declaration
public int RefCount { get; }
Property Value
Type Description
System.Int32

Methods

AddRef()

Increments the reference counter as an atomic operation.

Declaration
public int AddRef()
Returns
Type Description
System.Int32

The current reference count.

AsyncDispose()

Performs application-defined tasks associated with freeing, releasing, or resetting resources asynchronously

Declaration
protected override ValueTask AsyncDispose()
Returns
Type Description
System.Threading.Tasks.ValueTask
Overrides
Disposable.AsyncDispose()

Dispose(Boolean)

Method to be overridden to implement custom disposal logic.

Declaration
protected override void Dispose(bool disposeManaged)
Parameters
Type Name Description
System.Boolean disposeManaged

It is set to true on System.IDisposable.Dispose call.

Overrides
Disposable.Dispose(Boolean)

Release()

Decrements the reference counter as an atomic operation and disposes the object if the reference count reached the zero.

Declaration
public int Release()
Returns
Type Description
System.Int32

The current reference count.

ReleaseAsync()

Decrements the reference counter as an atomic operation and disposes the object asynchronously if the reference count reached the zero.

Declaration
public Task<int> ReleaseAsync()
Returns
Type Description
System.Threading.Tasks.Task<System.Int32>

The current reference count.

Implements

IDisposableEx
System.IDisposable
System.IAsyncDisposable
In This Article
Back to top Generated by DocFX