Table of Contents

Class SampleInterval

Namespace
Bonsai.Reactive
Assembly
Bonsai.Core.dll

Represents an operator that samples the latest element from the sequence whenever the specified time interval elapses.

Marble diagram

If multiple elements are received during each sampling period, SampleInterval will emit only the latest value. However, elements are never repeated: if no new elements are received between two sampling events, no notification will be emitted when the sampling period elapses.

public class SampleInterval : Combinator
Inheritance
SampleInterval
Inherited Members

Properties

Interval

Gets or sets the interval at which to sample. If this value is equal to Zero, the scheduler will continuously sample the stream.

public TimeSpan Interval { get; set; }

Property Value

TimeSpan

Methods

Process<TSource>(IObservable<TSource>)

Samples the latest element from an observable sequence whenever the specified time interval elapses.

public override IObservable<TSource> Process<TSource>(IObservable<TSource> source)

Parameters

source IObservable<TSource>

The source sequence to sample.

Returns

IObservable<TSource>

The sampled observable sequence.

Type Parameters

TSource

The type of the elements in the source sequence.

Remarks

Upon each sampling tick, the latest element (if any) emitted by the source sequence during the last sampling interval is sent to the resulting sequence.