)} ,System.TimeSpan)} ,System.Reactive.Concurrency.IScheduler)} ,System.Reactive.Concurrency.IScheduler,System.TimeSpan)}
ObservableSubscriptionExtensions.WaitForValue(IObservable) method¶
Defined in
Type: ObservableSubscriptionExtensions
Namespace: ReactiveUI.Extensions
Assembly: ReactiveUI.Extensions.dll
Applies to
net10.0, net10.0-browserwasm1.0, net10.0-desktop1.0, net9.0, net9.0-browserwasm1.0, net9.0-desktop1.0, net8.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.2, net8.0-macos14.5, net8.0-tvos17.2, netstandard2.1, net462, net481
Overloads¶
- 1.
public static T? WaitForValue<T>(this IObservable<T> source) - 2.
public static T? WaitForValue<T>(this IObservable<T> source, TimeSpan timeout) - 3.
public static T? WaitForValue<T>(this IObservable<T> source, IScheduler scheduler) - 4.
public static T? WaitForValue<T>(this IObservable<T> source, IScheduler scheduler, TimeSpan timeout)
1. Overload¶
public static T? WaitForValue<T>(this IObservable<T> source)
Summary:
Blocks until source emits a value, errors, or completes
(default 30s timeout).
Type parameters
| Name | Description |
|---|---|
T | The element type. |
Parameters
| Name | Type | Description |
|---|---|---|
source | IObservable | The observable to subscribe to. |
Returns: T? -- The last value emitted before terminal, or default if the sequence completed empty.
Exceptions
| Type | Condition |
|---|---|
| System.TimeoutException | The sequence did not terminate in time. |
2. Overload¶
public static T? WaitForValue<T>(this IObservable<T> source, TimeSpan timeout)
Summary:
Blocks until source emits a value, errors, or completes,
honoring an explicit timeout.
Type parameters
| Name | Description |
|---|---|
T | The element type. |
Parameters
| Name | Type | Description |
|---|---|---|
source | IObservable | The observable to subscribe to. |
timeout | TimeSpan | The wait timeout. |
Returns: T? -- The last value emitted before terminal, or default if the sequence completed empty.
Exceptions
| Type | Condition |
|---|---|
| System.TimeoutException | The sequence did not terminate within timeout. |
3. Overload¶
public static T? WaitForValue<T>(this IObservable<T> source, IScheduler scheduler)
Summary:
Blocks until source emits a value, errors, or completes,
routing the subscribe call through scheduler (default 30s timeout).
Type parameters
| Name | Description |
|---|---|
T | The element type. |
Parameters
| Name | Type | Description |
|---|---|---|
source | IObservable | The observable to subscribe to. |
scheduler | [IScheduler](# | Scheduler used to dispatch the subscribe call. |
Returns: T? -- The last value emitted before terminal, or default if the sequence completed empty.
Exceptions
| Type | Condition |
|---|---|
| System.TimeoutException | The sequence did not terminate in time. |
4. Overload¶
public static T? WaitForValue<T>(this IObservable<T> source, IScheduler scheduler, TimeSpan timeout)
Summary:
Blocks until source emits a value, errors, or completes,
routing the subscribe call through scheduler with an explicit
timeout.
Type parameters
| Name | Description |
|---|---|
T | The element type. |
Parameters
| Name | Type | Description |
|---|---|---|
source | IObservable | The observable to subscribe to. |
scheduler | [IScheduler](# | Scheduler used to dispatch the subscribe call. |
timeout | TimeSpan | The wait timeout. |
Returns: T? -- The last value emitted before terminal, or default if the sequence completed empty.
Exceptions
| Type | Condition |
|---|---|
| System.TimeoutException | The sequence did not terminate within timeout. |