Show / Hide Table of Contents

    Class Condition

    Provide ways to verify conditions a generic way for countless scenarios using true/false propositions.

    Inheritance
    System.Object
    Condition
    Namespace: Cuemon
    Assembly: Cuemon.Core.dll
    Syntax
    public static class Condition

    Methods

    | Improve this Doc

    AreEqual<T>(T, T)

    Determines whether the two specified x and y are equal by using the default equality operator from T.

    Declaration
    public static bool AreEqual<T>(T x, T y)
    Parameters
    Type Name Description
    T x

    The first object to compare.

    T y

    The second object to compare.

    Returns
    Type Description
    System.Boolean

    true if x are equal to y; otherwise false.

    Type Parameters
    Name Description
    T

    The type of objects to compare.

    | Improve this Doc

    AreEqual<T>(T, T, IEqualityComparer<T>)

    Determines whether the two specified x and y are equal by using the equality operator.

    Declaration
    public static bool AreEqual<T>(T x, T y, IEqualityComparer<T> comparer)
    Parameters
    Type Name Description
    T x

    The first object to compare.

    T y

    The second object to compare.

    System.Collections.Generic.IEqualityComparer<T> comparer

    The System.Collections.Generic.IEqualityComparer<T> implementation to use when comparing x and y.

    Returns
    Type Description
    System.Boolean

    true if x are equal to y; otherwise false.

    Type Parameters
    Name Description
    T

    The type of objects to compare.

    Exceptions
    Type Condition
    System.ArgumentNullException

    comparer is null.

    | Improve this Doc

    AreNotEqual<T>(T, T)

    Determines whether the two specified x and y are different by using the default equality operator from T.

    Declaration
    public static bool AreNotEqual<T>(T x, T y)
    Parameters
    Type Name Description
    T x

    The first object to compare.

    T y

    The second object to compare.

    Returns
    Type Description
    System.Boolean

    true if x are different from y; otherwise false.

    Type Parameters
    Name Description
    T

    The type of objects to compare.

    | Improve this Doc

    AreNotEqual<T>(T, T, IEqualityComparer<T>)

    Determines whether the two specified x and y are different by using the equality operator.

    Declaration
    public static bool AreNotEqual<T>(T x, T y, IEqualityComparer<T> comparer)
    Parameters
    Type Name Description
    T x

    The first object to compare.

    T y

    The second object to compare.

    System.Collections.Generic.IEqualityComparer<T> comparer

    The System.Collections.Generic.IEqualityComparer<T> implementation to use when comparing x and y.

    Returns
    Type Description
    System.Boolean

    true if x are different from y; otherwise false.

    Type Parameters
    Name Description
    T

    The type of objects to compare.

    Exceptions
    Type Condition
    System.ArgumentNullException

    comparer is null.

    | Improve this Doc

    AreNotSame<T>(T, T)

    Determines whether the two specified x object are not of the same instance as the y object.

    Declaration
    public static bool AreNotSame<T>(T x, T y)
    Parameters
    Type Name Description
    T x

    The first object to compare.

    T y

    The second object to compare.

    Returns
    Type Description
    System.Boolean

    true if x object are not of the same instance as the y object; otherwise false.

    Type Parameters
    Name Description
    T

    The type of objects to compare.

    | Improve this Doc

    AreSame<T>(T, T)

    Determines whether the two specified x object are of the same instance as the y object.

    Declaration
    public static bool AreSame<T>(T x, T y)
    Parameters
    Type Name Description
    T x

    The first object to compare.

    T y

    The second object to compare.

    Returns
    Type Description
    System.Boolean

    true if x object are of the same instance as the y object; otherwise false.

    Type Parameters
    Name Description
    T

    The type of objects to compare.

    | Improve this Doc

    FlipFlop(Boolean, Action, Action)

    Invokes one of two expressions depending on the value of condition.

    Declaration
    public static void FlipFlop(bool condition, Action firstExpression, Action secondExpression)
    Parameters
    Type Name Description
    System.Boolean condition

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

    System.Action firstExpression

    The delegate that is invoked when condition is true.

    System.Action secondExpression

    The delegate that is invoked when condition is false.

    | Improve this Doc

    FlipFlop<T>(Boolean, Action<T>, Action<T>, T)

    Invokes one of two expressions depending on the value of condition.

    Declaration
    public static void FlipFlop<T>(bool condition, Action<T> firstExpression, Action<T> secondExpression, T arg)
    Parameters
    Type Name Description
    System.Boolean condition

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

    System.Action<T> firstExpression

    The delegate that is invoked when condition is true.

    System.Action<T> secondExpression

    The delegate that is invoked when condition is false.

    T arg

    The parameter of the delegates firstExpression and secondExpression.

    Type Parameters
    Name Description
    T

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

    | Improve this Doc

    FlipFlop<T1, T2>(Boolean, Action<T1, T2>, Action<T1, T2>, T1, T2)

    Invokes one of two expressions depending on the value of condition.

    Declaration
    public static void FlipFlop<T1, T2>(bool condition, Action<T1, T2> firstExpression, Action<T1, T2> secondExpression, T1 arg1, T2 arg2)
    Parameters
    Type Name Description
    System.Boolean condition

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

    System.Action<T1, T2> firstExpression

    The delegate that is invoked when condition is true.

    System.Action<T1, T2> secondExpression

    The delegate that is invoked when condition is false.

    T1 arg1

    The first parameter of the delegates firstExpression and secondExpression.

    T2 arg2

    The second parameter of the delegates firstExpression and secondExpression.

    Type Parameters
    Name Description
    T1

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

    T2

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

    | Improve this Doc

    FlipFlop<T1, T2, T3>(Boolean, Action<T1, T2, T3>, Action<T1, T2, T3>, T1, T2, T3)

    Invokes one of two expressions depending on the value of condition.

    Declaration
    public static void FlipFlop<T1, T2, T3>(bool condition, Action<T1, T2, T3> firstExpression, Action<T1, T2, T3> secondExpression, T1 arg1, T2 arg2, T3 arg3)
    Parameters
    Type Name Description
    System.Boolean condition

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

    System.Action<T1, T2, T3> firstExpression

    The delegate that is invoked when condition is true.

    System.Action<T1, T2, T3> secondExpression

    The delegate that is invoked when condition is false.

    T1 arg1

    The first parameter of the delegates firstExpression and secondExpression.

    T2 arg2

    The second parameter of the delegates firstExpression and secondExpression.

    T3 arg3

    The third parameter of the delegates firstExpression and secondExpression.

    Type Parameters
    Name Description
    T1

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

    T2

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

    T3

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

    | Improve this Doc

    FlipFlop<T1, T2, T3, T4>(Boolean, Action<T1, T2, T3, T4>, Action<T1, T2, T3, T4>, T1, T2, T3, T4)

    Invokes one of two expressions depending on the value of condition.

    Declaration
    public static void FlipFlop<T1, T2, T3, T4>(bool condition, Action<T1, T2, T3, T4> firstExpression, Action<T1, T2, T3, T4> secondExpression, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
    Parameters
    Type Name Description
    System.Boolean condition

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

    System.Action<T1, T2, T3, T4> firstExpression

    The delegate that is invoked when condition is true.

    System.Action<T1, T2, T3, T4> secondExpression

    The delegate that is invoked when condition is false.

    T1 arg1

    The first parameter of the delegates firstExpression and secondExpression.

    T2 arg2

    The second parameter of the delegates firstExpression and secondExpression.

    T3 arg3

    The third parameter of the delegates firstExpression and secondExpression.

    T4 arg4

    The fourth parameter of the delegates firstExpression and secondExpression.

    Type Parameters
    Name Description
    T1

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

    T2

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

    T3

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

    T4

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

    | Improve this Doc

    FlipFlop<T1, T2, T3, T4, T5>(Boolean, Action<T1, T2, T3, T4, T5>, Action<T1, T2, T3, T4, T5>, T1, T2, T3, T4, T5)

    Invokes one of two expressions depending on the value of condition.

    Declaration
    public static void FlipFlop<T1, T2, T3, T4, T5>(bool condition, Action<T1, T2, T3, T4, T5> firstExpression, Action<T1, T2, T3, T4, T5> secondExpression, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
    Parameters
    Type Name Description
    System.Boolean condition

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

    System.Action<T1, T2, T3, T4, T5> firstExpression

    The delegate that is invoked when condition is true.

    System.Action<T1, T2, T3, T4, T5> secondExpression

    The delegate that is invoked when condition is false.

    T1 arg1

    The first parameter of the delegates firstExpression and secondExpression.

    T2 arg2

    The second parameter of the delegates firstExpression and secondExpression.

    T3 arg3

    The third parameter of the delegates firstExpression and secondExpression.

    T4 arg4

    The fourth parameter of the delegates firstExpression and secondExpression.

    T5 arg5

    The fifth parameter of the delegates firstExpression and secondExpression.

    Type Parameters
    Name Description
    T1

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

    T2

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

    T3

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

    T4

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

    T5

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

    | Improve this Doc

    Initialize<TTuple>(TTuple, Boolean)

    Initializes a new instance of the ConditionBuilder<TTuple> with the specified argument tuple and the boolean value.

    Declaration
    public static ConditionBuilder<TTuple> Initialize<TTuple>(TTuple tuple, bool value)
        where TTuple : Template
    Parameters
    Type Name Description
    TTuple tuple

    The argument for the invoker methods of ConditionBuilder<TTuple>.

    System.Boolean value

    The value of a condition that can be either true or false.

    Returns
    Type Description
    ConditionBuilder<TTuple>

    A new instance of the ConditionBuilder<TTuple> initialized with the specified argument tuple and the boolean value.

    Type Parameters
    Name Description
    TTuple

    The type of the n-tuple representation of a Template.

    | Improve this Doc

    Initialize<TTuple, TValue>(TTuple, TValue, Func<TValue, Boolean>)

    Initializes a new instance of the ConditionBuilder<TTuple> with the specified argument tuple and the result of the starting condition.

    Declaration
    public static ConditionBuilder<TTuple> Initialize<TTuple, TValue>(TTuple tuple, TValue value, Func<TValue, bool> condition)
        where TTuple : Template
    Parameters
    Type Name Description
    TTuple tuple

    The argument for the invoker methods of ConditionBuilder<TTuple>.

    TValue value

    The argument for condition.

    System.Func<TValue, System.Boolean> condition

    The delegate that will evaluate value.

    Returns
    Type Description
    ConditionBuilder<TTuple>

    A new instance of the ConditionBuilder<TTuple> initialized with the specified argument tuple and the result of the starting condition.

    Type Parameters
    Name Description
    TTuple

    The type of the n-tuple representation of a Template.

    TValue

    The type of the value for condition.

    | Improve this Doc

    IsDefault<T>(T)

    Determines whether the specified value has its initial default value.

    Declaration
    public static bool IsDefault<T>(T value)
    Parameters
    Type Name Description
    T value

    The object to verify has its initial default value.

    Returns
    Type Description
    System.Boolean

    true if the specified value has its initial default value; otherwise, false.

    Type Parameters
    Name Description
    T

    The type of the value.

    | Improve this Doc

    IsEmailAddress(String)

    Determines whether the specified value has a valid format of an email address.

    Declaration
    public static bool IsEmailAddress(string value)
    Parameters
    Type Name Description
    System.String value

    The string to verify has a valid format of an email address.

    Returns
    Type Description
    System.Boolean

    true if the specified value has a valid format of an email address; otherwise, false.

    Remarks

    In my search for the most comprehensive and up-to-date regular expression for email address validation, this was the article I choose to implement: http://blog.trojanhunter.com/2012/09/26/the-best-regex-to-validate-an-email-address/.

    | Improve this Doc

    IsEmpty(String)

    Determines whether the specified value is empty ("").

    Declaration
    public static bool IsEmpty(string value)
    Parameters
    Type Name Description
    System.String value

    The string to verify is empty.

    Returns
    Type Description
    System.Boolean

    true if the specified value is empty; otherwise, false.

    | Improve this Doc

    IsFalse(Boolean)

    Determines whether the specified value is false.

    Declaration
    public static bool IsFalse(bool value)
    Parameters
    Type Name Description
    System.Boolean value

    The value to verify is false.

    Returns
    Type Description
    System.Boolean

    true if the specified value is false; otherwise, false.

    | Improve this Doc

    IsGreaterThan<T>(T, T)

    Determines whether the specified x is greater than y.

    Declaration
    public static bool IsGreaterThan<T>(T x, T y)
        where T : struct, IConvertible
    Parameters
    Type Name Description
    T x

    The first object to compare.

    T y

    The second object to compare.

    Returns
    Type Description
    System.Boolean

    true if x is greater than y; otherwise false.

    Type Parameters
    Name Description
    T

    The type of objects to compare.

    | Improve this Doc

    IsGreaterThanOrEqual<T>(T, T)

    Determines whether the specified x is greater than or equal to y.

    Declaration
    public static bool IsGreaterThanOrEqual<T>(T x, T y)
        where T : struct, IConvertible
    Parameters
    Type Name Description
    T x

    The first object to compare.

    T y

    The second object to compare.

    Returns
    Type Description
    System.Boolean

    true if x is greater than or equal to y; otherwise false.

    Type Parameters
    Name Description
    T

    The type of objects to compare.

    | Improve this Doc

    IsGuid(String)

    Determines whether the specified value has a valid format of a System.Guid.

    Declaration
    public static bool IsGuid(string value)
    Parameters
    Type Name Description
    System.String value

    The string to verify has a valid format of a System.Guid.

    Returns
    Type Description
    System.Boolean

    true if the specified value has a format of a System.Guid; otherwise, false.

    Remarks

    This implementation only evaluates for GUID formats of: DigitFormat | BraceFormat | ParenthesisFormat, eg. 32 digits separated by hyphens; 32 digits separated by hyphens, enclosed in brackets and 32 digits separated by hyphens, enclosed in parentheses.
    The reason not to include NumberFormat, eg. 32 digits is the possible unintended GUID result of a MD5 string representation.

    | Improve this Doc

    IsGuid(String, GuidFormats)

    Determines whether the specified value has a valid format of a System.Guid.

    Declaration
    public static bool IsGuid(string value, GuidFormats format)
    Parameters
    Type Name Description
    System.String value

    The string to verify has a valid format of a System.Guid.

    GuidFormats format

    A bitmask comprised of one or more GuidFormats that specify how the GUID parsing is conducted.

    Returns
    Type Description
    System.Boolean

    true if the specified value has a format of a System.Guid; otherwise, false.

    | Improve this Doc

    IsHex(Char)

    Determines whether the specified value is hexadecimal.

    Declaration
    public static bool IsHex(char value)
    Parameters
    Type Name Description
    System.Char value

    The character to verify is hexadecimal.

    Returns
    Type Description
    System.Boolean

    true if the specified value is hexadecimal; otherwise, false.

    | Improve this Doc

    IsHex(String)

    Determines whether the specified value is hexadecimal.

    Declaration
    public static bool IsHex(string value)
    Parameters
    Type Name Description
    System.String value

    The string to verify is hexadecimal.

    Returns
    Type Description
    System.Boolean

    true if the specified value is hexadecimal; otherwise, false.

    | Improve this Doc

    IsLowerThan<T>(T, T)

    Determines whether the specified x is lower than y.

    Declaration
    public static bool IsLowerThan<T>(T x, T y)
        where T : struct, IConvertible
    Parameters
    Type Name Description
    T x

    The first object to compare.

    T y

    The second object to compare.

    Returns
    Type Description
    System.Boolean

    true if x is lower than y; otherwise false.

    Type Parameters
    Name Description
    T

    The type of objects to compare.

    | Improve this Doc

    IsLowerThanOrEqual<T>(T, T)

    Determines whether the specified x is lower than or equal to y.

    Declaration
    public static bool IsLowerThanOrEqual<T>(T x, T y)
        where T : struct, IConvertible
    Parameters
    Type Name Description
    T x

    The first object to compare.

    T y

    The second object to compare.

    Returns
    Type Description
    System.Boolean

    true if x is lower than or equal to y; otherwise false.

    Type Parameters
    Name Description
    T

    The type of objects to compare.

    | Improve this Doc

    IsNotDefault<T>(T)

    Determines whether the specified value does not have its initial default value.

    Declaration
    public static bool IsNotDefault<T>(T value)
    Parameters
    Type Name Description
    T value

    The object to verify does not have its initial default value.

    Returns
    Type Description
    System.Boolean

    true if the specified value does not have its initial default value; otherwise, false.

    Type Parameters
    Name Description
    T

    The type of the value.

    | Improve this Doc

    IsNotNull<T>(T)

    Determines whether the specified value is not null.

    Declaration
    public static bool IsNotNull<T>(T value)
    Parameters
    Type Name Description
    T value

    The object to verify is not null.

    Returns
    Type Description
    System.Boolean

    true if the specified value is not null; otherwise, false.

    Type Parameters
    Name Description
    T

    The type of the value.

    | Improve this Doc

    IsNotWithinRange<T>(T, T, T)

    Determines whether the specified x is outside the range of min and max.

    Declaration
    public static bool IsNotWithinRange<T>(T x, T min, T max)
        where T : struct, IConvertible
    Parameters
    Type Name Description
    T x

    The object to compare.

    T min

    The minimum value of x.

    T max

    The maximum value of x.

    Returns
    Type Description
    System.Boolean

    true if x is outside the range of min and max; otherwise false.

    Type Parameters
    Name Description
    T

    The type of objects to compare.

    | Improve this Doc

    IsNull<T>(T)

    Determines whether the specified value is null.

    Declaration
    public static bool IsNull<T>(T value)
    Parameters
    Type Name Description
    T value

    The object to verify is null.

    Returns
    Type Description
    System.Boolean

    true if the specified value is null; otherwise, false.

    Type Parameters
    Name Description
    T

    The type of the value.

    | Improve this Doc

    IsNumeric(String)

    Determines whether the specified value can be evaluated as a number.

    Declaration
    public static bool IsNumeric(string value)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    Returns
    Type Description
    System.Boolean

    true if the specified value can be evaluated as a number; otherwise, false.

    Remarks

    This method implements a default permitted format of value as System.Globalization.NumberStyles.Number.
    This method implements a default culture-specific formatting information about value specified to System.Globalization.CultureInfo.InvariantCulture.

    | Improve this Doc

    IsNumeric(String, NumberStyles)

    Determines whether the specified value can be evaluated as a number.

    Declaration
    public static bool IsNumeric(string value, NumberStyles styles)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.Globalization.NumberStyles styles

    A bitwise combination of System.Globalization.NumberStyles values that indicates the permitted format of value.

    Returns
    Type Description
    System.Boolean

    true if the specified value can be evaluated as a number; otherwise, false.

    Remarks

    This method implements a default culture-specific formatting information about value specified to System.Globalization.CultureInfo.InvariantCulture.

    | Improve this Doc

    IsNumeric(String, NumberStyles, IFormatProvider)

    Determines whether the specified value can be evaluated as a number.

    Declaration
    public static bool IsNumeric(string value, NumberStyles styles, IFormatProvider provider)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.Globalization.NumberStyles styles

    A bitwise combination of System.Globalization.NumberStyles values that indicates the permitted format of value.

    System.IFormatProvider provider

    An System.IFormatProvider that supplies culture-specific formatting information about value.

    Returns
    Type Description
    System.Boolean

    true if the specified value can be evaluated as a number; otherwise, false.

    | Improve this Doc

    IsTrue(Boolean)

    Determines whether the specified value is true.

    Declaration
    public static bool IsTrue(bool value)
    Parameters
    Type Name Description
    System.Boolean value

    The value to verify is true.

    Returns
    Type Description
    System.Boolean

    true if the specified value is true; otherwise, false.

    | Improve this Doc

    IsWhiteSpace(String)

    Determines whether the specified value consist only of white-space characters.

    Declaration
    public static bool IsWhiteSpace(string value)
    Parameters
    Type Name Description
    System.String value

    The string to verify consist only of white-space characters.

    Returns
    Type Description
    System.Boolean

    true if the specified value consist only of white-space characters; otherwise, false.

    | Improve this Doc

    IsWithinRange<T>(T, T, T)

    Determines whether the specified x is within range of min and max.

    Declaration
    public static bool IsWithinRange<T>(T x, T min, T max)
        where T : struct, IConvertible
    Parameters
    Type Name Description
    T x

    The object to compare.

    T min

    The minimum value of x.

    T max

    The maximum value of x.

    Returns
    Type Description
    System.Boolean

    true if x is within range of min and max; otherwise false.

    Type Parameters
    Name Description
    T

    The type of objects to compare.

    | Improve this Doc

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

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

    Declaration
    public static TResult TernaryIf<TResult>(bool condition, Func<TResult> firstExpression, Func<TResult> secondExpression)
    Parameters
    Type Name Description
    System.Boolean condition

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

    System.Func<TResult> firstExpression

    The function delegate that is invoked when condition is true.

    System.Func<TResult> secondExpression

    The function delegate that is invoked when condition is false.

    Returns
    Type Description
    TResult

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

    Type Parameters
    Name Description
    TResult

    The type of the result.

    | Improve this Doc

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

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

    Declaration
    public static TResult TernaryIf<T, TResult>(bool condition, Func<T, TResult> firstExpression, Func<T, TResult> secondExpression, T arg)
    Parameters
    Type Name Description
    System.Boolean condition

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

    System.Func<T, TResult> firstExpression

    The function delegate that is invoked when condition is true.

    System.Func<T, TResult> secondExpression

    The function delegate that is invoked when condition is false.

    T arg

    The parameter of the function delegates firstExpression and secondExpression.

    Returns
    Type Description
    TResult

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

    Type Parameters
    Name Description
    T

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

    TResult

    The type of the result.

    | Improve this Doc

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

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

    Declaration
    public static TResult TernaryIf<T1, T2, TResult>(bool condition, Func<T1, T2, TResult> firstExpression, Func<T1, T2, TResult> secondExpression, T1 arg1, T2 arg2)
    Parameters
    Type Name Description
    System.Boolean condition

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

    System.Func<T1, T2, TResult> firstExpression

    The function delegate that is invoked when condition is true.

    System.Func<T1, T2, TResult> secondExpression

    The function delegate that is invoked when condition is false.

    T1 arg1

    The first parameter of the function delegates firstExpression and secondExpression.

    T2 arg2

    The second parameter of the function delegates firstExpression and secondExpression.

    Returns
    Type Description
    TResult

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

    Type Parameters
    Name Description
    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.

    | Improve this Doc

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

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

    Declaration
    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
    Type Name Description
    System.Boolean condition

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

    System.Func<T1, T2, T3, TResult> firstExpression

    The function delegate that is invoked when condition is true.

    System.Func<T1, T2, T3, TResult> secondExpression

    The function delegate that is invoked when condition is false.

    T1 arg1

    The first parameter of the function delegates firstExpression and secondExpression.

    T2 arg2

    The second parameter of the function delegates firstExpression and secondExpression.

    T3 arg3

    The third parameter of the function delegates firstExpression and secondExpression.

    Returns
    Type Description
    TResult

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

    Type Parameters
    Name Description
    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.

    | Improve this Doc

    TernaryIf<T1, T2, T3, T4, TResult>(Boolean, 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.

    Declaration
    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
    Type Name Description
    System.Boolean condition

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

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

    The function delegate that is invoked when condition is true.

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

    The function delegate that is invoked when condition is false.

    T1 arg1

    The first parameter of the function delegates firstExpression and secondExpression.

    T2 arg2

    The second parameter of the function delegates firstExpression and secondExpression.

    T3 arg3

    The third parameter of the function delegates firstExpression and secondExpression.

    T4 arg4

    The fourth parameter of the function delegates firstExpression and secondExpression.

    Returns
    Type Description
    TResult

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

    Type Parameters
    Name Description
    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.

    | Improve this Doc

    TernaryIf<T1, T2, T3, T4, T5, TResult>(Boolean, 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.

    Declaration
    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
    Type Name Description
    System.Boolean condition

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

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

    The function delegate that is invoked when condition is true.

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

    The function delegate that is invoked when condition is false.

    T1 arg1

    The first parameter of the function delegates firstExpression and secondExpression.

    T2 arg2

    The second parameter of the function delegates firstExpression and secondExpression.

    T3 arg3

    The third parameter of the function delegates firstExpression and secondExpression.

    T4 arg4

    The fourth parameter of the function delegates firstExpression and secondExpression.

    T5 arg5

    The fifth parameter of the function delegates firstExpression and secondExpression.

    Returns
    Type Description
    TResult

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

    Type Parameters
    Name Description
    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.

    • Improve this Doc
    • View Source
    Back to top Copyright 2008-2018 Weubphoria. All rights reserved.
    Generated by DocFX