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

System.Reactive.Disposables.RefCountDisposable

public sealed class RefCountDisposable : ICancelable, IDisposable
Represents a disposable resource that only disposes its underlying disposable resource when all GetDisposabledependent disposable objects have been disposed.
namespace System.Reactive.Disposables { public sealed class RefCountDisposable : ICancelable, IDisposable { public bool IsDisposed { get; } public RefCountDisposable(IDisposable disposable); public RefCountDisposable(IDisposable disposable, bool throwWhenDisposed); public IDisposable GetDisposable(); public void Dispose(); } }