Click or drag to resize
QueryableExIfTResult Method (IQueryProvider, ExpressionFuncBoolean, IEnumerableTResult, IEnumerableTResult)
Returns an enumerable sequence based on the evaluation result of the given condition.

Namespace: System.Linq
Assembly: System.Interactive.Providers (in System.Interactive.Providers.dll) Version: 1.2.0.0
Syntax
C#
public static IQueryable<TResult> If<TResult>(
	this IQueryProvider provider,
	Expression<Func<bool>> condition,
	IEnumerable<TResult> thenSource,
	IEnumerable<TResult> elseSource
)

Parameters

provider
Type: System.LinqIQueryProvider
Query provider.
condition
Type: System.Linq.ExpressionsExpressionFuncBoolean
Condition to evaluate.
thenSource
Type: System.Collections.GenericIEnumerableTResult
Sequence to return in case the condition evaluates true.
elseSource
Type: System.Collections.GenericIEnumerableTResult
Sequence to return in case the condition evaluates false.

Type Parameters

TResult
Result sequence element type.

Return Value

Type: IQueryableTResult
Either of the two input sequences based on the result of evaluating the condition.

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