Table of Contents

Class WindowCountOperator

Namespace
RxSharp.Operators
Assembly
RxSharp.dll

The windowCount operator.

public static class WindowCountOperator
Inheritance
System.Object
WindowCountOperator

Methods

WindowCount<T>(Observable<T>, int, int?)

Like BufferCount<T>(Observable<T>, int, int?)'s overlapping-window algorithm, but emits live Observable<T> windows (each backed by its own Subject<T>) instead of buffered arrays. Ported directly from rxjs's own windowCount: the first window opens eagerly at subscription time (so even an empty or immediately-erroring source still emits exactly one, empty, window), a new window opens every startWindowEvery values (defaulting to windowSize, i.e. non-overlapping windows), and the oldest still-open window completes once it has received windowSize values — the two counters run independently, which is what produces overlapping windows when startWindowEvery is less than windowSize.

public static Observable<Observable<T>> WindowCount<T>(this Observable<T> source, int windowSize, int? startWindowEvery = null)

Parameters

source Observable<T>

The source observable.

windowSize int

The number of values each window collects before closing.

startWindowEvery int?

How often (in source values) a new window opens; defaults to windowSize for non-overlapping windows.

Returns

Observable<Observable<T>>

An observable of windows, each itself an observable of up to windowSize values.

Type Parameters

T

The element type of the source.