Table of Contents

Class Last

Namespace
Bonsai.Reactive
Assembly
Bonsai.Core.dll

Represents an operator that returns the last element of an observable sequence.

Marble diagram

If the sequence has no elements, Last will terminate with an error.

Example

Use Last to retrieve the last element of a sequence.

Last Example

Alternative

Use TakeLast to retrieve one or more elements from the end of the sequence.

Warning

There is a subtle but important difference between the Last operator and TakeLast(1). TakeLast(1) will complete successfully when the source sequence has no elements.

Use LastOrDefault to retrieve the last element or return a default element if the sequence is empty.

public class Last : Combinator
Inheritance
Last
Inherited Members

Methods

Process<TSource>(IObservable<TSource>)

Returns the last element of an observable sequence.