,System.Collections.Generic.IDictionary{--0,System.IObservable{--1}},System.IObservable{--1})} ,System.Collections.Generic.IDictionary{--0,System.IObservable{--1}},System.Reactive.Concurrency.IScheduler)} ,System.Collections.Generic.IDictionary{--0,System.IObservable{--1}})}
Observable.Case(Func, IDictionary>, IObservable) method¶
Defined in
Type: Observable
Namespace: System.Reactive.Linq
Assembly: System.Reactive.dll
Applies to
netstandard2.0
Overloads¶
- 1.
public static IObservable<TResult> Case<TValue, TResult>(Func<TValue> selector, IDictionary<TValue, IObservable<TResult>> sources, IObservable<TResult> defaultSource) where TValue : notnull - 2.
public static IObservable<TResult> Case<TValue, TResult>(Func<TValue> selector, IDictionary<TValue, IObservable<TResult>> sources, IScheduler scheduler) where TValue : notnull - 3.
public static IObservable<TResult> Case<TValue, TResult>(Func<TValue> selector, IDictionary<TValue, IObservable<TResult>> sources) where TValue : notnull
1. Overload¶
public static IObservable<TResult> Case<TValue, TResult>(Func<TValue> selector, IDictionary<TValue, IObservable<TResult>> sources, IObservable<TResult> defaultSource) where TValue : notnull
Summary:
Uses selector to determine which source in sources to return, choosing defaultSource if no match is found.
Type parameters
| Name | Description |
|---|---|
TValue | The type of the value returned by the selector function, used to look up the resulting source. |
TResult | The type of the elements in the result sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
selector | Func | Selector function invoked to determine the source to lookup in the sources dictionary. |
sources | IDictionary | Dictionary of sources to select from based on the selector invocation result. |
defaultSource | IObservable | Default source to select in case no matching source in sources is found. |
Returns: IObservablesources dictionary based on the selector invocation result, or defaultSource if no match is found.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | selector or sources or defaultSource is null. |
2. Overload¶
public static IObservable<TResult> Case<TValue, TResult>(Func<TValue> selector, IDictionary<TValue, IObservable<TResult>> sources, IScheduler scheduler) where TValue : notnull
Summary:
Uses selector to determine which source in sources to return, choosing an empty sequence on the specified scheduler if no match is found.
Type parameters
| Name | Description |
|---|---|
TValue | The type of the value returned by the selector function, used to look up the resulting source. |
TResult | The type of the elements in the result sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
selector | Func | Selector function invoked to determine the source to lookup in the sources dictionary. |
sources | IDictionary | Dictionary of sources to select from based on the selector invocation result. |
scheduler | [IScheduler](# | Scheduler to generate an empty sequence on in case no matching source in sources is found. |
Returns: IObservablesources dictionary based on the selector invocation result, or an empty sequence if no match is found.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | selector or sources or scheduler is null. |
3. Overload¶
public static IObservable<TResult> Case<TValue, TResult>(Func<TValue> selector, IDictionary<TValue, IObservable<TResult>> sources) where TValue : notnull
Summary:
Uses selector to determine which source in sources to return, choosing an empty sequence if no match is found.
Type parameters
| Name | Description |
|---|---|
TValue | The type of the value returned by the selector function, used to look up the resulting source. |
TResult | The type of the elements in the result sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
selector | Func | Selector function invoked to determine the source to lookup in the sources dictionary. |
sources | IDictionary | Dictionary of sources to select from based on the selector invocation result. |
Returns: IObservablesources dictionary based on the selector invocation result, or an empty sequence if no match is found.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | selector or sources is null. |