<PackageReference Include="System.Reactive" Version="4.1.4" />

MultipleAssignmentDisposable

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.

Initializes a new instance of the MultipleAssignmentDisposable class with no current underlying disposable.

public void Dispose()

Disposes the underlying disposable as well as all future replacements.