,System.IObserver{--0})} ,System.IObserver{--0},System.Reactive.Concurrency.IScheduler)}
Observable.Subscribe(IEnumerable, IObserver) method¶
Defined in
Type: Observable
Namespace: System.Reactive.Linq
Assembly: System.Reactive.dll
Applies to
netstandard2.0
Overloads¶
- 1.
public static IDisposable Subscribe<TSource>(this IEnumerable<TSource> source, IObserver<TSource> observer) - 2.
public static IDisposable Subscribe<TSource>(this IEnumerable<TSource> source, IObserver<TSource> observer, IScheduler scheduler)
1. Overload¶
public static IDisposable Subscribe<TSource>(this IEnumerable<TSource> source, IObserver<TSource> observer)
Summary: Subscribes an observer to an enumerable sequence.
Type parameters
| Name | Description |
|---|---|
TSource | The type of the elements in the source sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
source | IEnumerable | Enumerable sequence to subscribe to. |
observer | IObserver | Observer that will receive notifications from the enumerable sequence. |
Returns: IDisposable -- Disposable object that can be used to unsubscribe the observer from the enumerable
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | source or observer is null. |
2. Overload¶
public static IDisposable Subscribe<TSource>(this IEnumerable<TSource> source, IObserver<TSource> observer, IScheduler scheduler)
Summary: Subscribes an observer to an enumerable sequence, using the specified scheduler to run the enumeration loop.
Type parameters
| Name | Description |
|---|---|
TSource | The type of the elements in the source sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
source | IEnumerable | Enumerable sequence to subscribe to. |
observer | IObserver | Observer that will receive notifications from the enumerable sequence. |
scheduler | [IScheduler](# | Scheduler to perform the enumeration on. |
Returns: IDisposable -- Disposable object that can be used to unsubscribe the observer from the enumerable
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | source or observer or scheduler is null. |