Click or drag to resize
QueryableExCaseTValue, TResult Method (IQueryProvider, ExpressionFuncTValue, IDictionaryTValue, IEnumerableTResult, IEnumerableTResult)
Returns a sequence from a dictionary based on the result of evaluating a selector function, also specifying a default sequence.

Namespace: System.Linq
Assembly: System.Interactive.Providers (in System.Interactive.Providers.dll) Version: 1.2.0.0
Syntax
C#
public static IQueryable<TResult> Case<TValue, TResult>(
	this IQueryProvider provider,
	Expression<Func<TValue>> selector,
	IDictionary<TValue, IEnumerable<TResult>> sources,
	IEnumerable<TResult> defaultSource
)

Parameters

provider
Type: System.LinqIQueryProvider
Query provider.
selector
Type: System.Linq.ExpressionsExpressionFuncTValue
Selector function used to pick a sequence from the given sources.
sources
Type: System.Collections.GenericIDictionaryTValue, IEnumerableTResult
Dictionary mapping selector values onto resulting sequences.
defaultSource
Type: System.Collections.GenericIEnumerableTResult
Default sequence to return in case there's no corresponding source for the computed selector value.

Type Parameters

TValue
Type of the selector value.
TResult
Result sequence element type.

Return Value

Type: IQueryableTResult
The source sequence corresponding with the evaluated selector value; otherwise, the default source.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IQueryProvider. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also