<PackageReference Include="ReactiveUI.Disposables" Version="8.2.0" />

ReactiveUI.Primitives.Disposables.SingleDisposable

public sealed class SingleDisposable : IsDisposed, IDisposable
A disposable slot that accepts one assignment: a second assignment throws, and a value assigned after disposal is disposed immediately.
public bool IsDisposed { get; }

Gets a value indicating whether this instance is disposed.

Initializes a new instance of the SingleDisposable class.

public SingleDisposable(Action action)

Initializes a new instance of the SingleDisposable class.

public SingleDisposable(IDisposable disposable)

Initializes a new instance of the SingleDisposable class.

public SingleDisposable(IDisposable disposable, Action action)

Initializes a new instance of the SingleDisposable class.

public void Create(IDisposable disposable)

Assigns the disposable held by this slot.

public void Dispose()

Runs the constructor-supplied action, then disposes the assigned value and blocks further assignments; repeated calls have no further effect.