Skip to content

,--0)}

Observable.MostRecent(IObservable, TSource) method

Defined in

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

Applies to

netstandard2.0

public static IEnumerable<TSource> MostRecent<TSource>(this IObservable<TSource> source, TSource initialValue)

Summary: Returns an enumerable sequence whose enumeration returns the most recently observed element in the source observable sequence, using the specified initial value in case no element has been sampled yet. Enumerators on the resulting sequence never block and can produce the same element repeatedly.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence.

Parameters

NameTypeDescription
sourceIObservableSource observable sequence.
initialValueTSourceInitial value that will be yielded by the enumerable sequence if no element has been sampled yet.

Returns: IEnumerable -- The enumerable sequence that returns the last sampled element upon each iteration.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource is null.