Class WindowTimeOperator
The windowTime operator.
public static class WindowTimeOperator
- Inheritance
-
System.ObjectWindowTimeOperator
Methods
WindowTime<T>(Observable<T>, TimeSpan, TimeSpan?, int?, IScheduler?)
Like WindowCount<T>(Observable<T>, int, int?), but windows open and close on a fixed time period
instead of a value count. Mirrors rxjs's windowTime.
public static Observable<Observable<T>> WindowTime<T>(this Observable<T> source, TimeSpan windowTimeSpan, TimeSpan? windowCreationInterval = null, int? maxWindowSize = null, IScheduler? scheduler = null)
Parameters
sourceObservable<T>The source observable.
windowTimeSpanTimeSpanHow long each window stays open before closing.
windowCreationIntervalTimeSpan?How often a new window opens. Defaults to null (open a new window right after the previous one closes).
maxWindowSizeint?The maximum number of values a window may collect before closing early, regardless of
windowTimeSpan. Defaults to unlimited.schedulerISchedulerThe scheduler to time windows with; defaults to TaskPoolScheduler.
Returns
- Observable<Observable<T>>
An observable of windows, each itself an observable of the values collected during its lifetime.
Type Parameters
TThe element type of the source.
Remarks
The first window opens eagerly at subscription time. When windowCreationInterval is
null (the two-argument form), a new window opens immediately whenever the previous one
closes after windowTimeSpan elapses, producing non-overlapping windows. When
windowCreationInterval is given, new windows instead open on their own independent
timer (starting immediately, then every windowCreationInterval), each closing
windowTimeSpan after it opened — so multiple windows can be open at once if
windowCreationInterval is shorter than windowTimeSpan. Independent of
either timer, a window also closes as soon as it has received maxWindowSize values (a new
one opens immediately in the non-overlapping, windowCreationInterval-less form).