<PackageReference Include="System.Reactive" Version="6.0.0-preview.16" />

MultipleAssignmentDisposableValue

Represents a disposable resource whose underlying disposable resource can be swapped for another disposable resource.
public IDisposable Disposable { get; set; }

Gets or sets the underlying disposable. After disposal, the result of getting this property is undefined.

public bool IsDisposed { get; }

Gets a value that indicates whether the object is disposed.

public void Dispose()

Disposes the underlying disposable as well as all future replacements.

public bool TrySetFirst(IDisposable disposable)