ActionAsyncDisposable Class
Implements both IAsyncDisposable and IDisposable by invoking a given callback upon disposal.
public class ActionAsyncDisposable : IAsyncDisposable, IDisposable- Implements
Constructors
| Name | Description |
|---|---|
| ActionAsyncDisposable(Func<ValueTask>) | Initializes a new instance of the ActionAsyncDisposable class. |
ActionAsyncDisposable(Func<ValueTask>)
Initializes a new instance of the ActionAsyncDisposable class.
Parameters
onDisposeAsyncFunc<ValueTask>- A callback to invoke upon the first call to
ActionAsyncDisposable.DisposeorActionAsyncDisposable.DisposeAsync.
Exceptions
ArgumentNullExceptiononDisposeAsyncisnull.
See also
Methods
| Name | Description |
|---|---|
| Dispose() | When invoked for the first time, invokes the callback passed to the constructor and synchronously awaits its result. If / when invoked again, or if invoked after ActionAsyncDisposable.DisposeAsync, this method does nothing. |
| DisposeAsync() | When invoked for the first time, invokes the callback passed to the constructor. If / when invoked again, or if invoked after ActionAsyncDisposable.Dispose, this method does nothing. |
Dispose()
When invoked for the first time, invokes the callback passed to the constructor and synchronously awaits its result.
If / when invoked again, or if invoked after ActionAsyncDisposable.DisposeAsync, this method does nothing.
public void Dispose()DisposeAsync()
When invoked for the first time, invokes the callback passed to the constructor.
If / when invoked again, or if invoked after ActionAsyncDisposable.Dispose, this method does nothing.
public ValueTask DisposeAsync()