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.LinqAssembly: System.Interactive (in System.Interactive.dll) Version: 1.2.0.0
Syntaxpublic 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:
IEnumerableTResultThe given input sequence if the condition evaluates true; otherwise, an empty sequence.
See Also