/// <summary> /// Initializes a new instance of the <see cref="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) { _implementation = bufferSize switch { 1 => new ReplayOne(), int.MaxValue => new ReplayAll(), _ => new ReplayMany(bufferSize), }; }
/// <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; } }
/// <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 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 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); }
/// <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); }
/// <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); }