public void Dispose() { var observer = Interlocked.Exchange(ref this._observer, null); if (observer == null) { return; } this._subject.Unsubscribe(observer); this._subject = null; }
/// <summary> /// Initializes a new instance of the <see cref="System.Reactive.Subjects.ReplaySubject<T>" /> class with the specified buffer size. /// </summary> /// <param name="bufferSize">Maximum element count of the replay buffer.</param> /// <exception cref="ArgumentOutOfRangeException"><paramref name="bufferSize"/> is less than zero.</exception> public ReplaySubject(int bufferSize) { switch (bufferSize) { case 1: _implementation = new ReplayOne(); break; case int.MaxValue: _implementation = new ReplayAll(); break; default: _implementation = new ReplayMany(bufferSize); break; } }
public Subscription(IReplaySubjectImplementation <T> subject, IObserver <T> observer) { this._subject = subject; this._observer = observer; }
/// <summary> /// Initializes a new instance of the <see cref="System.Reactive.Subjects.ReplaySubject<T>" /> class with the specified scheduler. /// </summary> /// <param name="scheduler">Scheduler the observers are invoked on.</param> /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> is null.</exception> public ReplaySubject(IScheduler scheduler) { _implementation = new ReplayByTime(scheduler); }
//TODO: Does this overload make any sense with the optimisations? Surely this now is just <c>new ReplaySubject<T>(bufferSize).SubscribeOn(scheduler)</c>? //Potentially should be marked as obsolete /// <summary> /// Initializes a new instance of the <see cref="System.Reactive.Subjects.ReplaySubject<T>" /> class with the specified buffer size and scheduler. /// </summary> /// <param name="bufferSize">Maximum element count of the replay buffer.</param> /// <param name="scheduler">Scheduler the observers are invoked on.</param> /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> is null.</exception> /// <exception cref="ArgumentOutOfRangeException"><paramref name="bufferSize"/> is less than zero.</exception> public ReplaySubject(int bufferSize, IScheduler scheduler) { _implementation = new ReplayByTime(bufferSize, scheduler); }
/// <summary> /// Initializes a new instance of the <see cref="System.Reactive.Subjects.ReplaySubject<T>" /> class. /// </summary> public ReplaySubject() { _implementation = new ReplayAll(); }
/// <summary> /// Initializes a new instance of the <see cref="System.Reactive.Subjects.ReplaySubject<T>" /> class with the specified buffer size and window. /// </summary> /// <param name="bufferSize">Maximum element count of the replay buffer.</param> /// <param name="window">Maximum time length of the replay buffer.</param> /// <exception cref="ArgumentOutOfRangeException"><paramref name="bufferSize"/> is less than zero. -or- <paramref name="window"/> is less than TimeSpan.Zero.</exception> public ReplaySubject(int bufferSize, TimeSpan window) { _implementation = new ReplayByTime(bufferSize, window); }
public Subscription(IReplaySubjectImplementation subject, IObserver <T> observer) { _subject = subject; _observer = observer; }
/// <summary> /// Initializes a new instance of the <see cref="System.Reactive.Subjects.ReplaySubject<T>" /> class with the specified window. /// </summary> /// <param name="window">Maximum time length of the replay buffer.</param> /// <exception cref="ArgumentOutOfRangeException"><paramref name="window"/> is less than TimeSpan.Zero.</exception> public ReplaySubject(TimeSpan window) { _implementation = new ReplayByTime(window); }
/// <summary> /// Initializes a new instance of the <see cref="System.Reactive.Subjects.ReplaySubject<T>" /> class with the specified window and scheduler. /// </summary> /// <param name="window">Maximum time length of the replay buffer.</param> /// <param name="scheduler">Scheduler the observers are invoked on.</param> /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> is null.</exception> /// <exception cref="ArgumentOutOfRangeException"><paramref name="window"/> is less than TimeSpan.Zero.</exception> public ReplaySubject(TimeSpan window, IScheduler scheduler) { _implementation = new ReplayByTime(window, scheduler); }