,System.Func{--0,System.IObservable{--1}},System.Func{--1,--2},System.Func{--2,System.Boolean},--2)}
ReactiveExtensions.FirstMatchFromCandidates(IReadOnlyList, Func>, Func, Func, TResult) method¶
Defined in
Type: ReactiveExtensions
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
public static IObservable<TResult> FirstMatchFromCandidates<TKey, TRaw, TResult>(this IReadOnlyList<TKey> candidates, Func<TKey, IObservable<TRaw>> project, Func<TRaw, TResult> transform, Func<TResult, bool> predicate, TResult fallback)
Summary:
Walks a list of candidate keys sequentially, projects each into a one-shot
observable, transforms the raw value, and emits the first transformed value
that satisfies predicate. Errors from individual projections
are swallowed (the candidate is skipped). If no candidate matches, emits
fallback.
Type parameters
| Name | Description |
|---|---|
TKey | The candidate key type. |
TRaw | The raw element type emitted by the projection. |
TResult | The transformed result type. |
Parameters
| Name | Type | Description |
|---|---|---|
candidates | IReadOnlyList | The ordered list of candidate keys to walk. |
project | Func | Projects a key into a one-shot observable of raw values. |
transform | Func | Transform applied to each raw value to produce the result. |
predicate | Func | Returns true for a matching transformed value. |
fallback | TResult | Value emitted when no candidate matches. |
Returns: IObservablefallback.