Click or drag to resize
EnumerableExIfTResult Method (FuncBoolean, IEnumerableTResult)
Returns an enumerable sequence if the evaluation result of the given condition is true, otherwise returns an empty sequence.

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
)

Parameters

condition
Type: SystemFuncBoolean
Condition to evaluate.
thenSource
Type: System.Collections.GenericIEnumerableTResult
Sequence to return in case the condition evaluates true.

Type Parameters

TResult
Result sequence element type.

Return Value

Type: IEnumerableTResult
The given input sequence if the condition evaluates true; otherwise, an empty sequence.
See Also