Example #1
0
            public void Dispose()
            {
                _subject.Unsubscribe(this);

                lock (_locker)
                {
                    Observer = null;
                    _subject = null;
                }
            }
Example #2
0
        public ReplaySubject(int bufferSize)
        {
            if (bufferSize <= 0)
            {
                throw new ArgumentException("Buffer size cannot be equal to or less than 0");
            }

            _subject = new Subject <T>();

            (_replay, _add, _trim) = bufferSize switch
            {
                1 => CreateReplayOnce(),
                int.MaxValue => CreateReplayAll(),
                _ => CreateReplayMany(bufferSize)
            };
        }
Example #3
0
 public Subscription(SubjectBase <T> subject, IObserver <T> observer)
 {
     _subject = subject;
     Observer = observer;
 }
Example #4
0
 public BehaviorSubject(T initialValue)
 {
     _value   = initialValue;
     _subject = new Subject <T>();
 }