Table of Contents

TernaryIf Method

Definition

Namespace
Cuemon
Assemblies
Cuemon.Kernel.dll
Source
src/Cuemon.Kernel/Condition.cs

TernaryIf<TResult>(bool, Func<TResult>, Func<TResult>)

Returns one of two values depending on the value of condition.

public static TResult TernaryIf<TResult>(bool condition, Func<TResult> firstExpression, Func<TResult> secondExpression)

Parameters

condition bool

When true, the firstExpression is invoked and becomes the result; when false, the secondExpression is invoked and becomes the result.

firstExpression Func<TResult>

The function delegate that is invoked when condition is true.

secondExpression Func<TResult>

The function delegate that is invoked when condition is false.

Returns

TResult

The result of either function delegate firstExpression or function delegate secondExpression.

Type Parameters

TResult

The type of the result.

TernaryIf<T, TResult>(bool, Func<T, TResult>, Func<T, TResult>, T)

Returns one of two values depending on the value of condition.

public static TResult TernaryIf<T, TResult>(bool condition, Func<T, TResult> firstExpression, Func<T, TResult> secondExpression, T arg)

Parameters

condition bool

When true, the firstExpression is invoked and becomes the result; when false, the secondExpression is invoked and becomes the result.

firstExpression Func<T, TResult>

The function delegate that is invoked when condition is true.

secondExpression Func<T, TResult>

The function delegate that is invoked when condition is false.

arg T

The parameter of the function delegates firstExpression and secondExpression.

Returns

TResult

The result of either function delegate firstExpression or function delegate secondExpression.

Type Parameters

T

The type of the parameter of the function delegates firstExpression and secondExpression.

TResult

The type of the result.

TernaryIf<T1, T2, TResult>(bool, Func<T1, T2, TResult>, Func<T1, T2, TResult>, T1, T2)

Returns one of two values depending on the value of condition.

public static TResult TernaryIf<T1, T2, TResult>(bool condition, Func<T1, T2, TResult> firstExpression, Func<T1, T2, TResult> secondExpression, T1 arg1, T2 arg2)

Parameters

condition bool

When true, the firstExpression is invoked and becomes the result; when false, the secondExpression is invoked and becomes the result.

firstExpression Func<T1, T2, TResult>

The function delegate that is invoked when condition is true.

secondExpression Func<T1, T2, TResult>

The function delegate that is invoked when condition is false.

arg1 T1

The first parameter of the function delegates firstExpression and secondExpression.

arg2 T2

The second parameter of the function delegates firstExpression and secondExpression.

Returns

TResult

The result of either function delegate firstExpression or function delegate secondExpression.

Type Parameters

T1

The type of the first parameter of the function delegates firstExpression and secondExpression.

T2

The type of the second parameter of the function delegates firstExpression and secondExpression.

TResult

The type of the result.

TernaryIf<T1, T2, T3, TResult>(bool, Func<T1, T2, T3, TResult>, Func<T1, T2, T3, TResult>, T1, T2, T3)

Returns one of two values depending on the value of condition.

public static TResult TernaryIf<T1, T2, T3, TResult>(bool condition, Func<T1, T2, T3, TResult> firstExpression, Func<T1, T2, T3, TResult> secondExpression, T1 arg1, T2 arg2, T3 arg3)

Parameters

condition bool

When true, the firstExpression is invoked and becomes the result; when false, the secondExpression is invoked and becomes the result.

firstExpression Func<T1, T2, T3, TResult>

The function delegate that is invoked when condition is true.

secondExpression Func<T1, T2, T3, TResult>

The function delegate that is invoked when condition is false.

arg1 T1

The first parameter of the function delegates firstExpression and secondExpression.

arg2 T2

The second parameter of the function delegates firstExpression and secondExpression.

arg3 T3

The third parameter of the function delegates firstExpression and secondExpression.

Returns

TResult

The result of either function delegate firstExpression or function delegate secondExpression.

Type Parameters

T1

The type of the first parameter of the function delegates firstExpression and secondExpression.

T2

The type of the second parameter of the function delegates firstExpression and secondExpression.

T3

The type of the third parameter of the function delegates firstExpression and secondExpression.

TResult

The type of the result.

TernaryIf<T1, T2, T3, T4, TResult>(bool, Func<T1, T2, T3, T4, TResult>, Func<T1, T2, T3, T4, TResult>, T1, T2, T3, T4)

Returns one of two values depending on the value of condition.

public static TResult TernaryIf<T1, T2, T3, T4, TResult>(bool condition, Func<T1, T2, T3, T4, TResult> firstExpression, Func<T1, T2, T3, T4, TResult> secondExpression, T1 arg1, T2 arg2, T3 arg3, T4 arg4)

Parameters

condition bool

When true, the firstExpression is invoked and becomes the result; when false, the secondExpression is invoked and becomes the result.

firstExpression Func<T1, T2, T3, T4, TResult>

The function delegate that is invoked when condition is true.

secondExpression Func<T1, T2, T3, T4, TResult>

The function delegate that is invoked when condition is false.

arg1 T1

The first parameter of the function delegates firstExpression and secondExpression.

arg2 T2

The second parameter of the function delegates firstExpression and secondExpression.

arg3 T3

The third parameter of the function delegates firstExpression and secondExpression.

arg4 T4

The fourth parameter of the function delegates firstExpression and secondExpression.

Returns

TResult

The result of either function delegate firstExpression or function delegate secondExpression.

Type Parameters

T1

The type of the first parameter of the function delegates firstExpression and secondExpression.

T2

The type of the second parameter of the function delegates firstExpression and secondExpression.

T3

The type of the third parameter of the function delegates firstExpression and secondExpression.

T4

The type of the fourth parameter of the function delegates firstExpression and secondExpression.

TResult

The type of the result.

TernaryIf<T1, T2, T3, T4, T5, TResult>(bool, Func<T1, T2, T3, T4, T5, TResult>, Func<T1, T2, T3, T4, T5, TResult>, T1, T2, T3, T4, T5)

Returns one of two values depending on the value of condition.

public static TResult TernaryIf<T1, T2, T3, T4, T5, TResult>(bool condition, Func<T1, T2, T3, T4, T5, TResult> firstExpression, Func<T1, T2, T3, T4, T5, TResult> secondExpression, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)

Parameters

condition bool

When true, the firstExpression is invoked and becomes the result; when false, the secondExpression is invoked and becomes the result.

firstExpression Func<T1, T2, T3, T4, T5, TResult>

The function delegate that is invoked when condition is true.

secondExpression Func<T1, T2, T3, T4, T5, TResult>

The function delegate that is invoked when condition is false.

arg1 T1

The first parameter of the function delegates firstExpression and secondExpression.

arg2 T2

The second parameter of the function delegates firstExpression and secondExpression.

arg3 T3

The third parameter of the function delegates firstExpression and secondExpression.

arg4 T4

The fourth parameter of the function delegates firstExpression and secondExpression.

arg5 T5

The fifth parameter of the function delegates firstExpression and secondExpression.

Returns

TResult

The result of either function delegate firstExpression or function delegate secondExpression.

Type Parameters

T1

The type of the first parameter of the function delegates firstExpression and secondExpression.

T2

The type of the second parameter of the function delegates firstExpression and secondExpression.

T3

The type of the third parameter of the function delegates firstExpression and secondExpression.

T4

The type of the fourth parameter of the function delegates firstExpression and secondExpression.

T5

The type of the fifth parameter of the function delegates firstExpression and secondExpression.

TResult

The type of the result.