Skip to content

)} ,System.Func,System.IObservable{--1}})}

Observable.PublishLast(IObservable) method

Defined in

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

Applies to

netstandard2.0

Overloads

  • 1. public static IConnectableObservable<TSource> PublishLast<TSource>(this IObservable<TSource> source)
  • 2. public static IObservable<TResult> PublishLast<TSource, TResult>(this IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector)

1. Overload

public static IConnectableObservable<TSource> PublishLast<TSource>(this IObservable<TSource> source)

Summary: Returns a connectable observable sequence that shares a single subscription to the underlying sequence containing only the last notification. This operator is a specialization of Multicast using a AsyncSubject.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence.

Parameters

NameTypeDescription
sourceIObservableSource sequence whose elements will be multicasted through a single shared subscription.

Returns: IConnectableObservable -- A connectable observable sequence that shares a single subscription to the underlying sequence.

Remarks

Subscribers will only receive the last notification of the source.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource is null.

See also

2. Overload

public static IObservable<TResult> PublishLast<TSource, TResult>(this IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector)

Summary: Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence containing only the last notification. This operator is a specialization of Multicast using a AsyncSubject.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence.
TResultThe type of the elements in the result sequence.

Parameters

NameTypeDescription
sourceIObservableSource sequence whose elements will be multicasted through a single shared subscription.
selectorFunc, IObservable>Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will only receive the last notification of the source.

Returns: IObservable -- An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource or selector is null.

See also