>
Defined in Type: SignalAsync
Namespace: ReactiveUI.Primitives.Async
Assembly: ReactiveUI.Primitives.Async.Core.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, net471
public static IObservableAsync<T> FromAsync<T>(Func<CancellationToken, ValueTask<T>> factory)
Summary: Creates an asynchronous observable sequence that emits a single value produced by the specified factory function.
Type parameters
| Name | Description |
|---|---|
T | The type of the value produced by the factory and emitted by the observable sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
factory | Func | A function that asynchronously produces a value of type T when invoked with a CancellationToken. Cannot be null. |
Returns: IObservableAsync
Remarks
The observable sequence will emit the value produced by the factory and then signal completion. The factory function is invoked when the sequence is subscribed to, and supports cancellation via the provided CancellationToken.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | Thrown if factory is null. |