Skip to content

)} ,System.Func{--0,System.Boolean})}

Observable.Last(IObservable) method

Defined in

Type: Observable Namespace: System.Reactive.Linq Assembly: System.Reactive.dll

Applies to

netstandard2.0

Overloads

  • 1. public static TSource Last<TSource>(this IObservable<TSource> source)
  • 2. public static TSource Last<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate)

1. Overload

Deprecated

This blocking operation is no longer supported. Instead, use the async version in combination with C# and Visual Basic async/await support. In case you need a blocking operation, use Wait or convert the resulting observable sequence to a Task object and block.

Attributes: [Obsolete("This blocking operation is no longer supported. Instead, use the async version in combination with C# and Visual Basic async/await support. In case you need a blocking operation, use Wait or convert the resulting observable sequence to a Task object and block.")]

public static TSource Last<TSource>(this IObservable<TSource> source)

Summary: Returns the last element of an observable sequence.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence.

Parameters

NameTypeDescription
sourceIObservableSource observable sequence.

Returns: TSource -- The last element in the observable sequence.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource is null.
System.InvalidOperationExceptionThe source sequence is empty.

See also

2. Overload

Deprecated

This blocking operation is no longer supported. Instead, use the async version in combination with C# and Visual Basic async/await support. In case you need a blocking operation, use Wait or convert the resulting observable sequence to a Task object and block.

Attributes: [Obsolete("This blocking operation is no longer supported. Instead, use the async version in combination with C# and Visual Basic async/await support. In case you need a blocking operation, use Wait or convert the resulting observable sequence to a Task object and block.")]

public static TSource Last<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate)

Summary: Returns the last element of an observable sequence that satisfies the condition in the predicate.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence.

Parameters

NameTypeDescription
sourceIObservableSource observable sequence.
predicateFuncA predicate function to evaluate for elements in the source sequence.

Returns: TSource -- The last element in the observable sequence that satisfies the condition in the predicate.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource or predicate is null.
System.InvalidOperationExceptionNo element satisfies the condition in the predicate. -or- The source sequence is empty.

See also