Skip to content

SingleAssignmentDisposableAsync class

Defined in

Namespace: ReactiveUI.Extensions.Async.Disposables Assembly: ReactiveUI.Extensions.dll Full name: ReactiveUI.Extensions.Async.Disposables.SingleAssignmentDisposableAsync Modifiers: public sealed

Summary

View source

        Represents an asynchronously disposable resource that allows a single assignment of its underlying disposable. Once
        disposed, further assignments will dispose the assigned resource immediately.
        

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 SingleAssignmentDisposableAsync
class IAsyncDisposable {
    <>
}
IAsyncDisposable <|.. SingleAssignmentDisposableAsync

Implements: IAsyncDisposable

Remarks

This type is useful for scenarios where an asynchronous disposable resource must be assigned exactly once, and where disposal may occur before or after the assignment. If disposed before assignment, any subsequently assigned resource will be disposed immediately. This class is not thread-safe for concurrent assignment and disposal; external synchronization is required if used from multiple threads.

Constructors

NameSummary
.ctor

Properties

NameSummary
IsDisposedGets a value indicating whether the object has been disposed.

Methods

NameSummary
GetDisposableGets the current asynchronous disposable resource, or an empty disposable if the resource has already been disposed.
SetDisposableAsyncAsynchronously sets the current disposable resource to the specified value, replacing any previously set resource.
DisposeAsyncAsynchronously releases the unmanaged resources used by the object.
Inherited members