Observable.Throw(Exception) method¶
Defined in
Type: Observable
Namespace: System.Reactive.Linq
Assembly: System.Reactive.dll
Applies to
netstandard2.0
Overloads¶
- 1.
public static IObservable<TResult> Throw<TResult>(Exception exception) - 2.
public static IObservable<TResult> Throw<TResult>(Exception exception, TResult witness) - 3.
public static IObservable<TResult> Throw<TResult>(Exception exception, IScheduler scheduler) - 4.
public static IObservable<TResult> Throw<TResult>(Exception exception, IScheduler scheduler, TResult witness)
1. Overload¶
public static IObservable<TResult> Throw<TResult>(Exception exception)
Summary: Returns an observable sequence that terminates with an exception.
Type parameters
| Name | Description |
|---|---|
TResult | The type used for the IObservable type parameter of the resulting sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
exception | Exception | Exception object used for the sequence's termination. |
Returns: IObservable
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | exception is null. |
2. Overload¶
public static IObservable<TResult> Throw<TResult>(Exception exception, TResult witness)
Summary: Returns an observable sequence that terminates with an exception.
Type parameters
| Name | Description |
|---|---|
TResult | The type used for the IObservable type parameter of the resulting sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
exception | Exception | Exception object used for the sequence's termination. |
witness | TResult | Object solely used to infer the type of the TResult type parameter. This parameter is typically used when creating a sequence of anonymously typed elements. |
Returns: IObservable
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | exception is null. |
3. Overload¶
public static IObservable<TResult> Throw<TResult>(Exception exception, IScheduler scheduler)
Summary: Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single OnError message.
Type parameters
| Name | Description |
|---|---|
TResult | The type used for the IObservable type parameter of the resulting sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
exception | Exception | Exception object used for the sequence's termination. |
scheduler | [IScheduler](# | Scheduler to send the exceptional termination call on. |
Returns: IObservable
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | exception or scheduler is null. |
4. Overload¶
public static IObservable<TResult> Throw<TResult>(Exception exception, IScheduler scheduler, TResult witness)
Summary: Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single OnError message.
Type parameters
| Name | Description |
|---|---|
TResult | The type used for the IObservable type parameter of the resulting sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
exception | Exception | Exception object used for the sequence's termination. |
scheduler | [IScheduler](# | Scheduler to send the exceptional termination call on. |
witness | TResult | Object solely used to infer the type of the TResult type parameter. This parameter is typically used when creating a sequence of anonymously typed elements. |
Returns: IObservable
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | exception or scheduler is null. |