If__1_3 - waf/Rx.NET GitHub Wiki

QueryableEx.If<TResult> Method (IQueryProvider, Expression<Func<Boolean>>, IEnumerable<TResult>, IEnumerable<TResult>)

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)

Syntax

public static IQueryable<TResult> If<TResult>(
	this IQueryProvider provider,
	Expression<Func<bool>> condition,
	IEnumerable<TResult> thenSource,
	IEnumerable<TResult> elseSource
)

Parameters

provider

Type: System.Linq.IQueryProvider
Query provider.

condition

Type: System.Linq.Expressions.Expression<Func<Boolean>>
Condition to evaluate.

thenSource

Type: System.Collections.Generic.IEnumerable<TResult>
Sequence to return in case the condition evaluates true.

elseSource

Type: System.Collections.Generic.IEnumerable<TResult>
Sequence to return in case the condition evaluates false.

Type Parameters

TResult

Result sequence element type.

Return Value

Type: IQueryable<TResult>
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

Reference

QueryableEx Class
System.Linq Namespace

⚠️ **GitHub.com Fallback** ⚠️