Class BufferWhenOperator
The bufferWhen operator.
public static class BufferWhenOperator
- Inheritance
-
System.ObjectBufferWhenOperator
Methods
BufferWhen<T, TBoundary>(Observable<T>, Func<Observable<TBoundary>>)
Buffers source's values into an array, emitted (and immediately replaced by a fresh,
empty buffer) each time the observable returned by closingSelector emits or completes.
Mirrors rxjs's bufferWhen. Same closing-selector idea as
WindowWhen<T, TBoundary>(Observable<T>, Func<Observable<TBoundary>>), but collecting into arrays instead of live windows;
see its remarks for why each closing-notifier subscription is built directly via Create<T>(Action<T>?, Action<Exception>?, Action?)
assigned before subscribing, rather than a reassigned SingleAssignmentDisposable, and for why
each closing-notifier subscriber is also registered as a child of source's downstream
subscriber before being subscribed and removed again once superseded. The first buffer opens eagerly at
subscription time; closingSelector is invoked again, and its result subscribed to afresh,
every time a new buffer opens.
public static Observable<IReadOnlyList<T>> BufferWhen<T, TBoundary>(this Observable<T> source, Func<Observable<TBoundary>> closingSelector)
Parameters
sourceObservable<T>The source observable to buffer.
closingSelectorFunc<Observable<TBoundary>>Invoked (with no arguments) each time a buffer opens; the observable it returns closes (and emits) that buffer on its first next or complete notification.
Returns
- Observable<IReadOnlyList<T>>
An observable of each completed buffer as an IReadOnlyList<T>.
Type Parameters
TThe type of the elements collected into each buffer.
TBoundaryThe (unused) element type of the closing-notifier observable.