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

ReactiveUI.Primitives.Disposables.SwapDisposable

public sealed class SwapDisposable : IsDisposed, IDisposable
A disposable holder whose inner disposable can be re-assigned. The previous inner disposable is disposed when replaced (in contrast to MutableDisposable). Once this object is disposed, any subsequently assigned inner disposable is disposed immediately. Replaces SerialDisposable.
public IDisposable Disposable { get; set; }

Gets or sets the current inner disposable. Setting disposes the previous value.

public bool IsDisposed { get; }

Gets a value indicating whether this instance has been disposed.

public SwapDisposable()

public void Dispose()