Class BufferCountOperator
Implements the BufferCount operator. Mirrors rxjs's bufferCount.
public static class BufferCountOperator
- Inheritance
-
System.ObjectBufferCountOperator
Methods
BufferCount<T>(Observable<T>, int, int?)
Collects values from source into a buffer and emits the buffer, as a read-only list,
once it reaches bufferSize.
public static Observable<IReadOnlyList<T>> BufferCount<T>(this Observable<T> source, int bufferSize, int? startBufferEvery = null)
Parameters
sourceObservable<T>The source observable to buffer.
bufferSizeintThe number of values a buffer must contain before it is emitted.
startBufferEveryint?The number of values between the start of one buffer and the next. Defaults to
bufferSize(non-overlapping buffers) when null.
Returns
- Observable<IReadOnlyList<T>>
An observable of each completed (or trailing partial) buffer as an IReadOnlyList<T>.
Type Parameters
TThe type of the elements collected into each buffer.
Remarks
startBufferEvery controls how often a new buffer is started (every Nth value, counting
from the first). When omitted, it defaults to bufferSize, so buffers are opened right
after the previous one closes, producing non-overlapping chunks of bufferSize values.
A smaller value makes buffers overlap (multiple buffers open at once); a larger value skips values
between buffers. If source completes while one or more buffers are still short of
bufferSize, those partial buffers are emitted as-is, in the order they were opened,
before completion is forwarded.