Sink<TSource, TTarget>
Base class for implementation of query operators, providing a lightweight sink that can be disposed to mute the outgoing observer.
            
                using System.Runtime.CompilerServices;
namespace System.Reactive
{
    [System.Runtime.CompilerServices.NullableContext(1)]
    [System.Runtime.CompilerServices.Nullable(new byte[] {
        0,
        1
    })]
    internal abstract class Sink<[System.Runtime.CompilerServices.Nullable(2)] TSource, [System.Runtime.CompilerServices.Nullable(2)] TTarget> : Sink<TTarget>, IObserver<TSource>
    {
        [System.Runtime.CompilerServices.Nullable(0)]
        private sealed class _ : IObserver<TTarget>
        {
            private readonly Sink<TSource, TTarget> _forward;
            public _(Sink<TSource, TTarget> forward)
            {
                _forward = forward;
            }
            public void OnNext(TTarget value)
            {
                _forward.ForwardOnNext(value);
            }
            public void OnError(Exception error)
            {
                _forward.ForwardOnError(error);
            }
            public void OnCompleted()
            {
                _forward.ForwardOnCompleted();
            }
        }
        protected Sink(IObserver<TTarget> observer)
            : base(observer)
        {
        }
        public virtual void Run(IObservable<TSource> source)
        {
            SetUpstream(ObservableExtensions.SubscribeSafe<TSource>(source, (IObserver<TSource>)this));
        }
        public abstract void OnNext(TSource value);
        public virtual void OnError(Exception error)
        {
            ForwardOnError(error);
        }
        public virtual void OnCompleted()
        {
            ForwardOnCompleted();
        }
        public IObserver<TTarget> GetForwarder()
        {
            return new _(this);
        }
    }
}