Qbservable.DeferAsync(IQbservableProvider, Expression>>>) method¶
Defined in
Type: Qbservable
Namespace: System.Reactive.Linq
Assembly: System.Reactive.dll
Applies to
netstandard2.0
Overloads¶
- 1.
public static IQbservable<TResult> DeferAsync<TResult>(this IQbservableProvider provider, Expression<Func<CancellationToken, Task<IObservable<TResult>>>> observableFactoryAsync) - 2.
public static IQbservable<TResult> DeferAsync<TResult>(this IQbservableProvider provider, Expression<Func<CancellationToken, Task<IObservable<TResult>>>> observableFactoryAsync, bool ignoreExceptionsAfterUnsubscribe)
1. Overload¶
public static IQbservable<TResult> DeferAsync<TResult>(this IQbservableProvider provider, Expression<Func<CancellationToken, Task<IObservable<TResult>>>> observableFactoryAsync)
Summary: Returns an observable sequence that starts the specified cancellable asynchronous factory function whenever a new observer subscribes. The CancellationToken passed to the asynchronous factory function is tied to the returned disposable subscription, allowing best-effort cancellation.
Type parameters
| Name | Description |
|---|---|
TResult | The type of the elements in the sequence returned by the factory function, and in the resulting sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
provider | [IQbservableProvider](# | Query provider used to construct the [IQbservable](# data source. |
observableFactoryAsync | Expression | Asynchronous factory function to start for each observer that subscribes to the resulting sequence. |
Returns: IQbservable
Remarks
When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous observable factory function will be signaled.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | observableFactoryAsync is null. |
2. Overload¶
public static IQbservable<TResult> DeferAsync<TResult>(this IQbservableProvider provider, Expression<Func<CancellationToken, Task<IObservable<TResult>>>> observableFactoryAsync, bool ignoreExceptionsAfterUnsubscribe)
Summary: Returns an observable sequence that starts the specified cancellable asynchronous factory function whenever a new observer subscribes. The CancellationToken passed to the asynchronous factory function is tied to the returned disposable subscription, allowing best-effort cancellation.
Type parameters
| Name | Description |
|---|---|
TResult | The type of the elements in the sequence returned by the factory function, and in the resulting sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
provider | [IQbservableProvider](# | Query provider used to construct the [IQbservable](# data source. |
observableFactoryAsync | Expression | Asynchronous factory function to start for each observer that subscribes to the resulting sequence. |
ignoreExceptionsAfterUnsubscribe | bool | If true, exceptions that occur after cancellation has been initiated by unsubscribing from the observable this method returns will be handled and silently ignored. If false, they will go unobserved, meaning they will eventually emerge through UnobservedTaskException. |
Returns: IQbservable
Remarks
When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous observable factory function will be signaled.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | observableFactoryAsync is null. |