Table of Contents

Class ShareOperator

Namespace
RxSharp.Operators
Assembly
RxSharp.dll

Implements the Share operator. Mirrors rxjs's share() with its default config.

public static class ShareOperator
Inheritance
System.Object
ShareOperator

Methods

Share<T>(Observable<T>)

Multicasts source through an internal Subject<T>, subscribing to the source only once (on the first subscriber) and unsubscribing when the last subscriber leaves. A later subscription after the subscriber count drops back to zero reconnects to the source from scratch. See ShareCore for the shared refCount logic. Equivalent to source.Share(new ShareConfig<T>()) -- rxjs's own defaults (resetOnError: true, resetOnComplete: true, resetOnRefCountZero: true, plain Subject<T>).

public static Observable<T> Share<T>(this Observable<T> source)

Parameters

source Observable<T>

The source observable to multicast.

Returns

Observable<T>

A multicast observable that shares one subscription to source among all its subscribers.

Type Parameters

T

The element type of the source observable.

Share<T>(Observable<T>, ShareConfig<T>)

Multicasts source the same way as Share<T>(Observable<T>), but with each reset trigger and the connector factory configurable via config. See ShareConfig<T> for what each option controls.

public static Observable<T> Share<T>(this Observable<T> source, ShareConfig<T> config)

Parameters

source Observable<T>

The source observable to multicast.

config ShareConfig<T>

The reset/connector configuration to use.

Returns

Observable<T>

A multicast observable that shares one subscription to source among all its subscribers.

Type Parameters

T

The element type of the source observable.