Table of Contents

Class DisposableAsync

Namespace
ReactiveUI.Extensions.Async.Disposables
Assembly
ReactiveUI.Extensions.dll

Provides factory methods for creating and working with implementations of IAsyncDisposable.

public static class DisposableAsync
Inheritance
DisposableAsync

Remarks

This class offers utility members to simplify the creation of asynchronous disposables, such as wrapping a delegate in an IAsyncDisposable implementation or providing a no-op disposable instance. All members are thread-safe and can be used to facilitate resource management in asynchronous scenarios.

Properties

Empty

Gets an IAsyncDisposable instance that performs no action when disposed asynchronously.

public static IAsyncDisposable Empty { get; }

Property Value

IAsyncDisposable

Remarks

Use this property when an IAsyncDisposable is required but no disposal logic is necessary. This can be useful as a default or placeholder implementation.

Methods

Create(Func<ValueTask>)

Creates a new asynchronous disposable object that invokes the specified delegate when disposed asynchronously.

public static IAsyncDisposable Create(Func<ValueTask> disposeAsync)

Parameters

disposeAsync Func<ValueTask>

A delegate that is called to perform asynchronous disposal logic when the returned object is disposed. Cannot be null.

Returns

IAsyncDisposable

An IAsyncDisposable instance that invokes the specified delegate when disposed asynchronously.