Observable.AutoConnect(IConnectableObservable, int, Action?) method¶
Defined in
Type: Observable
Namespace: System.Reactive.Linq
Assembly: System.Reactive.dll
Applies to
netstandard2.0
public static IObservable<TSource> AutoConnect<TSource>(this IConnectableObservable<TSource> source, int minObservers = 1, Action<IDisposable>? onConnect = null)
Summary: Automatically connect the upstream IConnectableObservable at most once when the specified number of IObservers have subscribed to this IObservable.
Type parameters
| Name | Description |
|---|---|
TSource | The type of the elements in the source sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
source | [IConnectableObservable | Connectable observable sequence. |
minObservers = 1 | int | The number of observers required to subscribe before the connection to source happens, non-positive value will trigger an immediate subscription. |
onConnect = null | Action | If not null, the connection's IDisposable is provided to it. |
Returns: IObservable
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | source is null. |