Class WindowTrigger
Represents an operator that projects each element of an observable sequence into zero or more windows created when the second sequence emits a notification.
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.
[Combinator]
public class WindowTrigger
- Inheritance
-
WindowTrigger
- Inherited Members
Properties
Count
Gets or sets the maximum number of elements in each window.
public int? Count { get; set; }
Property Value
- int?
Remarks
If no value is specified, the window will have its length specified by either a maximum time span, or the boundary indicated by a notification from the second sequence.
TimeSpan
Gets or sets the time length of each window.
public TimeSpan? TimeSpan { get; set; }
Property Value
Remarks
If no value is specified, the window will have its length specified by either a maximum number of elements, or the boundary indicated by a notification from the second sequence.
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.
public IObservable<IObservable<TSource>> Process<TSource, TWindowOpening>(IObservable<TSource> source, IObservable<TWindowOpening> windowOpenings)
Parameters
source
IObservable<TSource>The source sequence to produce windows over.
windowOpenings
IObservable<TWindowOpening>The sequence of window openings. If no maximum length is specified, the current window is closed and a new window is opened upon receiving a notification from this sequence.
Returns
- IObservable<IObservable<TSource>>
An observable sequence of windows.
Type Parameters
TSource
The type of the elements in the
source
sequence.TWindowOpening
The type of the elements in the
windowOpenings
sequence.