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

ReactiveUI.Primitives.Disposables.SingleDisposable

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()

Disposes the assigned value and blocks further assignments; repeated calls have no further effect.

protected virtual void Dispose(bool disposing)

Runs the constructor-supplied action and then disposes the assigned value, once.