Table of Contents

Class TakeLast

Namespace
Bonsai.Reactive
Assembly
Bonsai.Core.dll

Represents an operator that returns a specified number of contiguous elements from the end of an observable sequence.

Marble diagram

The TakeLast operator modifies the source sequence to emit only a specified maximum number of values from the end of the sequence. Since TakeLast does not know which elements are the last before the original sequence terminates, it will not emit any value until the completion event is emitted, but will instead keep in memory the specified number of "latest" values. At the time when the source sequence terminates, TakeLast will immediately emit all buffered values up to the specified maximum number of elements and then terminate.

Because of this buffering behavior, TakeLast will always modify the behavior of the original sequence, regardless of how many values it contains.

public class TakeLast : Combinator
Inheritance
TakeLast
Inherited Members

Properties

Count

Gets or sets the number of elements to take from the end of the sequence.

public int Count { get; set; }

Property Value

int

Methods

Process<TSource>(IObservable<TSource>)

Returns a specified number of contiguous elements from the end of an observable sequence.

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

Parameters

source IObservable<TSource>

The sequence to take elements from.

Returns

IObservable<TSource>

An observable sequence containing the specified number of elements from the end of the source sequence.

Type Parameters

TSource

The type of the elements in the source sequence.