,System.Action{--0})} ,System.Action{--0,System.Int32})}
Observable.ForEach(IObservable, Action) method¶
Defined in
Type: Observable
Namespace: System.Reactive.Linq
Assembly: System.Reactive.dll
Applies to
netstandard2.0
Overloads¶
- 1.
public static void ForEach<TSource>(this IObservable<TSource> source, Action<TSource> onNext) - 2.
public static void ForEach<TSource>(this IObservable<TSource> source, Action<TSource, int> onNext)
1. Overload¶
Deprecated
This blocking operation is no longer supported. Instead, use the async version in combination with C# and Visual Basic async/await support. In case you need a blocking operation, use Wait or convert the resulting observable sequence to a Task object and block.
Attributes: [Obsolete("This blocking operation is no longer supported. Instead, use the async version in combination with C# and Visual Basic async/await support. In case you need a blocking operation, use Wait or convert the resulting observable sequence to a Task object and block.")]
public static void ForEach<TSource>(this IObservable<TSource> source, Action<TSource> onNext)
Summary: Invokes an action for each element in the observable sequence, and blocks until the sequence is terminated.
Type parameters
| Name | Description |
|---|---|
TSource | The type of the elements in the source sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
source | IObservable | Source sequence. |
onNext | Action | Action to invoke for each element in the observable sequence. |
Remarks
Because of its blocking nature, this operator is mainly used for testing.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | source or onNext is null. |
2. Overload¶
Deprecated
This blocking operation is no longer supported. Instead, use the async version in combination with C# and Visual Basic async/await support. In case you need a blocking operation, use Wait or convert the resulting observable sequence to a Task object and block.
Attributes: [Obsolete("This blocking operation is no longer supported. Instead, use the async version in combination with C# and Visual Basic async/await support. In case you need a blocking operation, use Wait or convert the resulting observable sequence to a Task object and block.")]
public static void ForEach<TSource>(this IObservable<TSource> source, Action<TSource, int> onNext)
Summary: Invokes an action for each element in the observable sequence, incorporating the element's index, and blocks until the sequence is terminated.
Type parameters
| Name | Description |
|---|---|
TSource | The type of the elements in the source sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
source | IObservable | Source sequence. |
onNext | Action | Action to invoke for each element in the observable sequence. |
Remarks
Because of its blocking nature, this operator is mainly used for testing.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | source or onNext is null. |