SingleAssignmentDisposableValue
Represents a disposable resource which only allows a single assignment of its underlying disposable resource.
            If an underlying disposable resource has already been set, future attempts to set the underlying disposable resource will throw an  InvalidOperationException.
            
                using System.Runtime.CompilerServices;
using System.Threading;
namespace System.Reactive.Disposables
{
    [System.Runtime.CompilerServices.NullableContext(2)]
    [System.Runtime.CompilerServices.Nullable(0)]
    internal struct SingleAssignmentDisposableValue
    {
        private IDisposable _current;
        public bool IsDisposed => Volatile.Read(ref _current) == BooleanDisposable.True;
        public IDisposable Disposable {
            get {
                return System.Reactive.Disposables.Disposable.GetValueOrDefault(ref _current);
            }
            set {
                if (System.Reactive.Disposables.Disposable.TrySetSingle(ref _current, value) == TrySetSingleResult.AlreadyAssigned)
                    throw new InvalidOperationException(Strings_Core.DISPOSABLE_ALREADY_ASSIGNED);
            }
        }
        public void Dispose()
        {
            System.Reactive.Disposables.Disposable.Dispose(ref _current);
        }
    }
}