Class DisposableAsyncMixins
- Namespace
- ReactiveUI.Extensions.Async
- Assembly
- ReactiveUI.Extensions.dll
Provides extension methods for converting synchronous disposable objects to asynchronous disposables.
public static class DisposableAsyncMixins
- Inheritance
-
DisposableAsyncMixins
Remarks
These extension methods enable the use of existing IDisposable implementations in asynchronous disposal scenarios by wrapping them as IAsyncDisposable. This is useful when working with APIs that require asynchronous disposal, but only a synchronous Dispose method is available.
Methods
ToDisposableAsync(IDisposable)
Converts an IDisposable instance to an IAsyncDisposable wrapper.
public static IAsyncDisposable ToDisposableAsync(this IDisposable @this)
Parameters
thisIDisposableThe IDisposable instance to wrap as an IAsyncDisposable.
Returns
- IAsyncDisposable
An IAsyncDisposable that disposes the underlying IDisposable when disposed asynchronously.
Remarks
The returned IAsyncDisposable invokes the synchronous Dispose() method when DisposeAsync() is called. This is useful for integrating synchronous disposables into asynchronous disposal patterns.