Table of Contents

Class TakeLastOperator

Namespace
RxSharp.Operators
Assembly
RxSharp.dll

Implements the TakeLast operator. Mirrors rxjs's takeLast.

public static class TakeLastOperator
Inheritance
System.Object
TakeLastOperator

Methods

TakeLast<T>(Observable<T>, int)

Buffers up to the last count values from source, emitting all of them, in the order they were received, only once source completes.

public static Observable<T> TakeLast<T>(this Observable<T> source, int count)

Parameters

source Observable<T>

The source observable to buffer values from.

count int

The maximum number of trailing values to emit.

Returns

Observable<T>

An observable that emits at most the last count values from source, all at once, once it completes. If count is zero or less, an empty, already-completed observable is returned and source is never subscribed to.

Type Parameters

T

The element type of the source observable.

Remarks

If source emits fewer than count values before completing, all of them are emitted. Because nothing is emitted until source completes, using TakeLast<T>(Observable<T>, int) with a source that never completes results in an observable that never emits anything.