Skip to content

)} ,System.TimeSpan)} ,System.TimeSpan,System.Reactive.Concurrency.IScheduler)} ,System.Int32)} ,System.Int32,System.TimeSpan)} ,System.Int32,System.TimeSpan,System.Reactive.Concurrency.IScheduler)}

Observable.RefCount(IConnectableObservable) method

Defined in

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

Applies to

netstandard2.0

Overloads

  • 1. public static IObservable<TSource> RefCount<TSource>(this IConnectableObservable<TSource> source)
  • 2. public static IObservable<TSource> RefCount<TSource>(this IConnectableObservable<TSource> source, TimeSpan disconnectDelay)
  • 3. public static IObservable<TSource> RefCount<TSource>(this IConnectableObservable<TSource> source, TimeSpan disconnectDelay, IScheduler scheduler)
  • 4. public static IObservable<TSource> RefCount<TSource>(this IConnectableObservable<TSource> source, int minObservers)
  • 5. public static IObservable<TSource> RefCount<TSource>(this IConnectableObservable<TSource> source, int minObservers, TimeSpan disconnectDelay)
  • 6. public static IObservable<TSource> RefCount<TSource>(this IConnectableObservable<TSource> source, int minObservers, TimeSpan disconnectDelay, IScheduler scheduler)

1. Overload

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

Summary: Returns an observable sequence that stays connected to the source as long as there is at least one subscription to the observable sequence.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence.

Parameters

NameTypeDescription
source[IConnectableObservable](#Connectable observable sequence.

Returns: IObservable -- An observable sequence that stays connected to the source as long as there is at least one subscription to the observable sequence.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource is null.

2. Overload

public static IObservable<TSource> RefCount<TSource>(this IConnectableObservable<TSource> source, TimeSpan disconnectDelay)

Summary: Returns an observable sequence that stays connected to the source as long as there is at least one subscription to the observable sequence.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence.

Parameters

NameTypeDescription
source[IConnectableObservable](#Connectable observable sequence.
disconnectDelayTimeSpanThe time span that should be waited before possibly unsubscribing from the connectable observable.

Returns: IObservable -- An observable sequence that stays connected to the source as long as there is at least one subscription to the observable sequence.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource is null.

3. Overload

public static IObservable<TSource> RefCount<TSource>(this IConnectableObservable<TSource> source, TimeSpan disconnectDelay, IScheduler scheduler)

Summary: Returns an observable sequence that stays connected to the source as long as there is at least one subscription to the observable sequence.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence.

Parameters

NameTypeDescription
source[IConnectableObservable](#Connectable observable sequence.
disconnectDelayTimeSpanThe time span that should be waited before possibly unsubscribing from the connectable observable.
scheduler[IScheduler](#The scheduler to use for delayed unsubscription.

Returns: IObservable -- An observable sequence that stays connected to the source as long as there is at least one subscription to the observable sequence.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource is null.

4. Overload

public static IObservable<TSource> RefCount<TSource>(this IConnectableObservable<TSource> source, int minObservers)

Summary: Returns an observable sequence that stays connected to the source as long as there is at least one subscription to the observable sequence.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence.

Parameters

NameTypeDescription
source[IConnectableObservable](#Connectable observable sequence.
minObserversintThe minimum number of observers required to subscribe before establishing the connection to the source.

Returns: IObservable -- An observable sequence that stays connected to the source as long as there is at least one subscription to the observable sequence.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource is null.
System.ArgumentOutOfRangeExceptionminObservers is non-positive.

5. Overload

public static IObservable<TSource> RefCount<TSource>(this IConnectableObservable<TSource> source, int minObservers, TimeSpan disconnectDelay)

Summary: Returns an observable sequence that stays connected to the source as long as there is at least one subscription to the observable sequence.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence.

Parameters

NameTypeDescription
source[IConnectableObservable](#Connectable observable sequence.
minObserversintThe minimum number of observers required to subscribe before establishing the connection to the source.
disconnectDelayTimeSpanThe time span that should be waited before possibly unsubscribing from the connectable observable.

Returns: IObservable -- An observable sequence that stays connected to the source as long as there is at least one subscription to the observable sequence.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource is null.
System.ArgumentOutOfRangeExceptionminObservers is non-positive.

6. Overload

public static IObservable<TSource> RefCount<TSource>(this IConnectableObservable<TSource> source, int minObservers, TimeSpan disconnectDelay, IScheduler scheduler)

Summary: Returns an observable sequence that stays connected to the source as long as there is at least one subscription to the observable sequence.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence.

Parameters

NameTypeDescription
source[IConnectableObservable](#Connectable observable sequence.
minObserversintThe minimum number of observers required to subscribe before establishing the connection to the source.
disconnectDelayTimeSpanThe time span that should be waited before possibly unsubscribing from the connectable observable.
scheduler[IScheduler](#The scheduler to use for delayed unsubscription.

Returns: IObservable -- An observable sequence that stays connected to the source as long as there is at least one subscription to the observable sequence.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource is null.
System.ArgumentOutOfRangeExceptionminObservers is non-positive.