If__1 - waf/Rx.NET GitHub Wiki

EnumerableEx.If<TResult> Method (Func<Boolean>, IEnumerable<TResult>)

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)

Syntax

public static IEnumerable<TResult> If<TResult>(
	Func<bool> condition,
	IEnumerable<TResult> thenSource
)

Parameters

condition

Type: System.Func<Boolean>
Condition to evaluate.

thenSource

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

Type Parameters

TResult

Result sequence element type.

Return Value

Type: IEnumerable<TResult>
The given input sequence if the condition evaluates true; otherwise, an empty sequence.

See Also

Reference

EnumerableEx Class
System.Linq Namespace

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