SerialDisposableAsync class¶
Defined in
Namespace: ReactiveUI.Extensions.Async.Disposables
Assembly: ReactiveUI.Extensions.dll
Full name: ReactiveUI.Extensions.Async.Disposables.SerialDisposableAsync
Modifiers: public
Summary¶
Provides a thread-safe mechanism for managing a single asynchronously disposable resource that can be replaced or
disposed of serially.
Applies to
net10.0, net10.0-browserwasm1.0, net10.0-desktop1.0, net9.0, net9.0-browserwasm1.0, net9.0-desktop1.0, net8.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.2, net8.0-macos14.5, net8.0-tvos17.2, netstandard2.1, net462, net481
Class hierarchy
classDiagram
class SerialDisposableAsync
class IAsyncDisposable {
<>
}
IAsyncDisposable <|.. SerialDisposableAsync
Implements: IAsyncDisposable
Remarks¶
When a new disposable is set using SetDisposableAsync, the previously held disposable (if any) is asynchronously disposed. Disposing the SerialDisposableAsync instance disposes the current disposable and prevents further disposables from being set. This class is useful for scenarios where a resource needs to be replaced or updated over time, ensuring that only one resource is active and properly disposed of at any given moment. All operations are safe to use concurrently from multiple threads.
Constructors¶
| Name | Summary |
|---|---|
| .ctor |
Methods¶
| Name | Summary |
|---|---|
| SetDisposableAsync | Replaces the currently tracked asynchronous disposable resource with a new one, disposing the previous resource if present. |
| DisposeAsync | Asynchronously releases the resources used by the object. |