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

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

Parameters

condition
Type: SystemFuncBoolean
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: IEnumerableTResult
Either of the two input sequences based on the result of evaluating the condition.
See Also