Table of Contents

Class WindowTrigger

Namespace
Bonsai.Reactive
Assembly
Bonsai.Core.dll

Represents an operator that projects each element of an observable sequence into zero or more windows created when the second sequence emits a notification.

Marble diagram

WindowTrigger groups the notifications of the source sequence into new observable sequences, where the opening of each window is triggered by the notifications of the second sequence. The rules for closing each window can be specified using the Count and TimeSpan properties.

If neither count nor time span are specified, windows will be strictly non-overlapping, with the previous window being closed when a new window is created. In this case, and only this case, the first window is also created immediately at the start of the sequence.

If the Count property or the TimeSpan property is specified, then a new window is created when the second sequence emits a notification, and it is automatically closed after either the specified number of elements is collected or the specified time span elapses. If a new window is created before the previous window is closed, then window will overlap, and any elements emitted during this period will be included in both windows. If at any moment there is no open window, elements emitted from the source sequence will be dropped.

Note

You can manipulate and schedule each of the windows downstream using other higher-order operators such as Merge, Concat or Switch.

[Combinator]
public class WindowTrigger
Inheritance
WindowTrigger
Inherited Members

Properties

Count

Gets or sets the maximum number of elements in each window.

TimeSpan

Gets or sets the time length of each window.

Methods

Process<TSource, TWindowOpening>(IObservable<TSource>, IObservable<TWindowOpening>)

Projects each element of an observable sequence into zero or more windows created when a second sequence emits a notification.