Class Condition
- Namespace
- Cuemon
- Assembly
- Cuemon.Core.dll
Provide ways to verify conditions a generic way for countless scenarios using true/false propositions.
public sealed class Condition
- Inheritance
-
Condition
Properties
Query
Gets the singleton instance of the Condition functionality allowing for extensions methods like: Condition.Query.IsTrue().
public static Condition Query { get; }
Property Value
- Condition
The singleton instance of the Condition functionality.
Methods
AreEqual<T>(T, T)
Determines whether the two specified x and y are equal by using the default equality operator from T.
public static bool AreEqual<T>(T x, T y)
Parameters
xTThe first object to compare.
yTThe second object to compare.
Returns
- bool
trueifxare equal toy; otherwisefalse.
Type Parameters
TThe type of objects to compare.
AreEqual<T>(T, T, IEqualityComparer<T>)
Determines whether the two specified x and y are equal by using the equality operator.
public static bool AreEqual<T>(T x, T y, IEqualityComparer<T> comparer)
Parameters
xTThe first object to compare.
yTThe second object to compare.
comparerIEqualityComparer<T>The IEqualityComparer<T> implementation to use when comparing
xandy.
Returns
- bool
trueifxare equal toy; otherwisefalse.
Type Parameters
TThe type of objects to compare.
Exceptions
- ArgumentNullException
compareris null.
AreNotEqual<T>(T, T)
Determines whether the two specified x and y are different by using the default equality operator from T.
public static bool AreNotEqual<T>(T x, T y)
Parameters
xTThe first object to compare.
yTThe second object to compare.
Returns
- bool
trueifxare different fromy; otherwisefalse.
Type Parameters
TThe type of objects to compare.
AreNotEqual<T>(T, T, IEqualityComparer<T>)
Determines whether the two specified x and y are different by using the equality operator.
public static bool AreNotEqual<T>(T x, T y, IEqualityComparer<T> comparer)
Parameters
xTThe first object to compare.
yTThe second object to compare.
comparerIEqualityComparer<T>The IEqualityComparer<T> implementation to use when comparing
xandy.
Returns
- bool
trueifxare different fromy; otherwisefalse.
Type Parameters
TThe type of objects to compare.
Exceptions
- ArgumentNullException
compareris null.
AreNotSame<T>(T, T)
Determines whether the two specified x object are not of the same instance as the y object.
public static bool AreNotSame<T>(T x, T y)
Parameters
xTThe first object to compare.
yTThe second object to compare.
Returns
- bool
trueifxobject are not of the same instance as theyobject; otherwisefalse.
Type Parameters
TThe type of objects to compare.
AreSame<T>(T, T)
Determines whether the two specified x object are of the same instance as the y object.
public static bool AreSame<T>(T x, T y)
Parameters
xTThe first object to compare.
yTThe second object to compare.
Returns
- bool
trueifxobject are of the same instance as theyobject; otherwisefalse.
Type Parameters
TThe type of objects to compare.
FlipFlop(bool, Action, Action)
Invokes one of two expressions depending on the value of condition.
public static void FlipFlop(bool condition, Action firstExpression, Action secondExpression)
Parameters
conditionboolWhen
true, thefirstExpressionis invoked; whenfalse, thesecondExpressionis invoked.firstExpressionActionThe delegate that is invoked when
conditionistrue.secondExpressionActionThe delegate that is invoked when
conditionisfalse.
FlipFlopAsync(bool, Func<Task>, Func<Task>)
Invokes one of two expressions depending on the value of condition.
public static Task FlipFlopAsync(bool condition, Func<Task> firstExpression, Func<Task> secondExpression)
Parameters
conditionboolWhen
true, thefirstExpressionis invoked; whenfalse, thesecondExpressionis invoked.firstExpressionFunc<Task>The function delegate that is invoked when
conditionistrue.secondExpressionFunc<Task>The function delegate that is invoked when
conditionisfalse.
Returns
FlipFlop<T>(bool, Action<T>, Action<T>, T)
Invokes one of two expressions depending on the value of condition.
public static void FlipFlop<T>(bool condition, Action<T> firstExpression, Action<T> secondExpression, T arg)
Parameters
conditionboolWhen
true, thefirstExpressionis invoked; whenfalse, thesecondExpressionis invoked.firstExpressionAction<T>The delegate that is invoked when
conditionistrue.secondExpressionAction<T>The delegate that is invoked when
conditionisfalse.argTThe parameter of the delegates
firstExpressionandsecondExpression.
Type Parameters
TThe type of the parameter of the delegates
firstExpressionandsecondExpression.
FlipFlop<T1, T2>(bool, Action<T1, T2>, Action<T1, T2>, T1, T2)
Invokes one of two expressions depending on the value of condition.
public static void FlipFlop<T1, T2>(bool condition, Action<T1, T2> firstExpression, Action<T1, T2> secondExpression, T1 arg1, T2 arg2)
Parameters
conditionboolWhen
true, thefirstExpressionis invoked; whenfalse, thesecondExpressionis invoked.firstExpressionAction<T1, T2>The delegate that is invoked when
conditionistrue.secondExpressionAction<T1, T2>The delegate that is invoked when
conditionisfalse.arg1T1The first parameter of the delegates
firstExpressionandsecondExpression.arg2T2The second parameter of the delegates
firstExpressionandsecondExpression.
Type Parameters
T1The type of the first parameter of the delegates
firstExpressionandsecondExpression.T2The type of the second parameter of the delegates
firstExpressionandsecondExpression.
FlipFlop<T1, T2, T3>(bool, Action<T1, T2, T3>, Action<T1, T2, T3>, T1, T2, T3)
Invokes one of two expressions depending on the value of condition.
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
conditionboolWhen
true, thefirstExpressionis invoked; whenfalse, thesecondExpressionis invoked.firstExpressionAction<T1, T2, T3>The delegate that is invoked when
conditionistrue.secondExpressionAction<T1, T2, T3>The delegate that is invoked when
conditionisfalse.arg1T1The first parameter of the delegates
firstExpressionandsecondExpression.arg2T2The second parameter of the delegates
firstExpressionandsecondExpression.arg3T3The third parameter of the delegates
firstExpressionandsecondExpression.
Type Parameters
T1The type of the first parameter of the delegates
firstExpressionandsecondExpression.T2The type of the second parameter of the delegates
firstExpressionandsecondExpression.T3The type of the third parameter of the delegates
firstExpressionandsecondExpression.
FlipFlop<T1, T2, T3, T4>(bool, 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.
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
conditionboolWhen
true, thefirstExpressionis invoked; whenfalse, thesecondExpressionis invoked.firstExpressionAction<T1, T2, T3, T4>The delegate that is invoked when
conditionistrue.secondExpressionAction<T1, T2, T3, T4>The delegate that is invoked when
conditionisfalse.arg1T1The first parameter of the delegates
firstExpressionandsecondExpression.arg2T2The second parameter of the delegates
firstExpressionandsecondExpression.arg3T3The third parameter of the delegates
firstExpressionandsecondExpression.arg4T4The fourth parameter of the delegates
firstExpressionandsecondExpression.
Type Parameters
T1The type of the first parameter of the delegates
firstExpressionandsecondExpression.T2The type of the second parameter of the delegates
firstExpressionandsecondExpression.T3The type of the third parameter of the delegates
firstExpressionandsecondExpression.T4The type of the fourth parameter of the delegates
firstExpressionandsecondExpression.
FlipFlop<T1, T2, T3, T4, T5>(bool, 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.
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
conditionboolWhen
true, thefirstExpressionis invoked; whenfalse, thesecondExpressionis invoked.firstExpressionAction<T1, T2, T3, T4, T5>The delegate that is invoked when
conditionistrue.secondExpressionAction<T1, T2, T3, T4, T5>The delegate that is invoked when
conditionisfalse.arg1T1The first parameter of the delegates
firstExpressionandsecondExpression.arg2T2The second parameter of the delegates
firstExpressionandsecondExpression.arg3T3The third parameter of the delegates
firstExpressionandsecondExpression.arg4T4The fourth parameter of the delegates
firstExpressionandsecondExpression.arg5T5The fifth parameter of the delegates
firstExpressionandsecondExpression.
Type Parameters
T1The type of the first parameter of the delegates
firstExpressionandsecondExpression.T2The type of the second parameter of the delegates
firstExpressionandsecondExpression.T3The type of the third parameter of the delegates
firstExpressionandsecondExpression.T4The type of the fourth parameter of the delegates
firstExpressionandsecondExpression.T5The type of the fifth parameter of the delegates
firstExpressionandsecondExpression.
HasConsecutiveCharacters(string, char, int)
Determines whether the specified value contains a succession character of length.
public static bool HasConsecutiveCharacters(string value, char character, int length = 2)
Parameters
valuestringThe value to test for consecutive characters.
charactercharThe characters to locate with the specified
length.lengthintThe number of characters in succession.
Returns
- bool
trueif the specifiedvaluecontains a successioncharacteroflength; otherwise,false.
HasConsecutiveCharacters(string, IEnumerable<char>, int)
Determines whether the specified value contains at least one of the succession characters of length.
public static bool HasConsecutiveCharacters(string value, IEnumerable<char> characters, int length = 2)
Parameters
valuestringThe value to test for consecutive characters.
charactersIEnumerable<char>The character to locate with the specified
length.lengthintThe number of characters in succession.
Returns
- bool
trueif the specifiedvaluecontains at least one of the successioncharactersoflength; otherwise,false.
HasDifference(string, string, out string)
Determines whether there is a set difference between second and first.
public static bool HasDifference(string first, string second, out string difference)
Parameters
firststringThe value where characters that are not also in
secondwill be returned.secondstringThe value to compare with
first.differencestringThe set difference between
secondandfirstor Empty if no difference.
Returns
- bool
trueif there is a set difference betweensecondandfirst; otherwisefalse.
IsBase64(string)
Determines whether the specified value matches a base-64 structure.
public static bool IsBase64(string value)
Parameters
valuestringThe value to test for a Base64 structure.
Returns
- bool
trueif the specifiedvaluematches a base-64 structure; otherwise,false.
IsBinaryDigits(string)
Determines whether the specified value consists only of binary digits.
public static bool IsBinaryDigits(string value)
Parameters
valuestringThe string to verify consist only of binary digits.
Returns
- bool
trueif the specifiedvalueconsists only of binary digits; otherwise,false.
IsCountableSequence(IEnumerable<int>)
Determines whether the specified source is a sequence of countable integrals (hence, integrals being either incremented or decremented with the same cardinality through out the sequence).
public static bool IsCountableSequence(IEnumerable<int> source)
Parameters
sourceIEnumerable<int>The value to test for a sequence of countable characters.
Returns
- bool
trueif the specifiedsourceis a sequence of countable integrals (hence, integrals being either incremented or decremented with the same cardinality through out the sequence); otherwise,false.
IsCountableSequence(IEnumerable<long>)
Determines whether the specified source is a sequence of countable integrals (hence, integrals being either incremented or decremented with the same cardinality through out the sequence).
public static bool IsCountableSequence(IEnumerable<long> source)
Parameters
sourceIEnumerable<long>The value to test for a sequence of countable characters.
Returns
- bool
trueif the specifiedsourceis a sequence of countable integrals (hence, integrals being either incremented or decremented with the same cardinality through out the sequence); otherwise,false.
IsCountableSequence(string)
Determines whether the specified value is a sequence of countable characters (hence, characters being either incremented or decremented with the same cardinality through out the sequence).
public static bool IsCountableSequence(string value)
Parameters
valuestringThe value to test for a sequence of countable characters.
Returns
- bool
trueif the specifiedvalueis a sequence of countable characters (hence, characters being either incremented or decremented with the same cardinality through out the sequence); otherwise,false.
IsDefault<T>(T)
Determines whether the specified value has its initial default value.
public static bool IsDefault<T>(T value)
Parameters
valueTThe object to verify has its initial default value.
Returns
- bool
trueif the specifiedvaluehas its initial default value; otherwise,false.
Type Parameters
TThe type of the value.
IsEmailAddress(string)
Determines whether the specified value has a valid format of an email address.
public static bool IsEmailAddress(string value)
Parameters
valuestringThe string to verify has a valid format of an email address.
Returns
- bool
trueif the specifiedvaluehas 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/.
IsEmpty(string)
Determines whether the specified value is empty ("").
public static bool IsEmpty(string value)
Parameters
valuestringThe string to verify is empty.
Returns
- bool
trueif the specifiedvalueis empty; otherwise,false.
IsEnum<T>(string, Action<EnumStringOptions>)
Determines whether the specified value is valid by attempting to construct an enumeration of T.
public static bool IsEnum<T>(string value, Action<EnumStringOptions> setup = null) where T : struct, IConvertible
Parameters
valuestringThe string containing the name or value used to attempt to construct an Enum.
setupAction<EnumStringOptions>The EnumStringOptions which may be configured.
Returns
- bool
trueif the specifiedvalueis a valid enumeration; otherwise,false.
Type Parameters
TThe type of the enumeration to validate.
IsEven(int)
Determines whether the specified value is an even number.
public static bool IsEven(int value)
Parameters
valueintThe value to evaluate.
Returns
- bool
trueif the specifiedvalueis an even number; otherwise,false.
IsFalse(bool)
Determines whether the specified value is false.
public static bool IsFalse(bool value)
Parameters
valueboolThe value to verify is
false.
Returns
- bool
trueif the specifiedvalueisfalse; otherwise,false.
IsFalse(bool, Action)
Invokes the delegate expression when value of condition is false.
public static void IsFalse(bool condition, Action expression)
Parameters
conditionboolWhen
false, theexpressiondelegate is invoked.expressionActionThe delegate that is invoked when
conditionisfalse.
IsGreaterThanOrEqual<T>(T, T)
Determines whether the specified x is greater than or equal to y.
public static bool IsGreaterThanOrEqual<T>(T x, T y) where T : struct, IConvertible
Parameters
xTThe first object to compare.
yTThe second object to compare.
Returns
- bool
trueifxis greater than or equal toy; otherwisefalse.
Type Parameters
TThe type of objects to compare.
IsGreaterThan<T>(T, T)
Determines whether the specified x is greater than y.
public static bool IsGreaterThan<T>(T x, T y) where T : struct, IConvertible
Parameters
xTThe first object to compare.
yTThe second object to compare.
Returns
- bool
trueifxis greater thany; otherwisefalse.
Type Parameters
TThe type of objects to compare.
IsGuid(string)
Determines whether the specified value has a valid format of a Guid.
public static bool IsGuid(string value)
Parameters
Returns
Remarks
This implementation only evaluates for GUID formats of: D | B | P, 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 N, eg. 32 digits is the possible unintended GUID result of a MD5 string representation.
IsGuid(string, GuidFormats)
Determines whether the specified value has a valid format of a Guid.
public static bool IsGuid(string value, GuidFormats format)
Parameters
valuestringThe string to verify has a valid format of a Guid.
formatGuidFormatsA bitmask comprised of one or more GuidFormats that specify how the GUID parsing is conducted.
Returns
IsHex(char)
Determines whether the specified value is hexadecimal.
public static bool IsHex(char value)
Parameters
valuecharThe character to verify is hexadecimal.
Returns
- bool
trueif the specifiedvalueis hexadecimal; otherwise,false.
IsHex(string)
Determines whether the specified value is hexadecimal.
public static bool IsHex(string value)
Parameters
valuestringThe string to verify is hexadecimal.
Returns
- bool
trueif the specifiedvalueis hexadecimal; otherwise,false.
IsLowerThanOrEqual<T>(T, T)
Determines whether the specified x is lower than or equal to y.
public static bool IsLowerThanOrEqual<T>(T x, T y) where T : struct, IConvertible
Parameters
xTThe first object to compare.
yTThe second object to compare.
Returns
- bool
trueifxis lower than or equal toy; otherwisefalse.
Type Parameters
TThe type of objects to compare.
IsLowerThan<T>(T, T)
Determines whether the specified x is lower than y.
public static bool IsLowerThan<T>(T x, T y) where T : struct, IConvertible
Parameters
xTThe first object to compare.
yTThe second object to compare.
Returns
- bool
trueifxis lower thany; otherwisefalse.
Type Parameters
TThe type of objects to compare.
IsNotDefault<T>(T)
Determines whether the specified value does not have its initial default value.
public static bool IsNotDefault<T>(T value)
Parameters
valueTThe object to verify does not have its initial default value.
Returns
- bool
trueif the specifiedvaluedoes not have its initial default value; otherwise,false.
Type Parameters
TThe type of the value.
IsNotNull<T>(T)
Determines whether the specified value is not null.
public static bool IsNotNull<T>(T value)
Parameters
valueTThe object to verify is not null.
Returns
- bool
trueif the specifiedvalueis not null; otherwise,false.
Type Parameters
TThe type of the value.
IsNotWithinRange<T>(T, T, T)
Determines whether the specified x is outside the range of min and max.
public static bool IsNotWithinRange<T>(T x, T min, T max) where T : struct, IConvertible
Parameters
xTThe object to compare.
minTThe minimum value of
x.maxTThe maximum value of
x.
Returns
- bool
trueifxis outside the range ofminandmax; otherwisefalse.
Type Parameters
TThe type of objects to compare.
IsNull<T>(T)
Determines whether the specified value is null.
public static bool IsNull<T>(T value)
Parameters
valueTThe object to verify is null.
Returns
- bool
trueif the specifiedvalueis null; otherwise,false.
Type Parameters
TThe type of the value.
IsNumeric(string, NumberStyles, IFormatProvider)
Determines whether the specified value can be evaluated as a number.
public static bool IsNumeric(string value, NumberStyles styles = NumberStyles.Number, IFormatProvider provider = null)
Parameters
valuestringThe value to be evaluated.
stylesNumberStylesA bitwise combination of NumberStyles values that indicates the permitted format of
value.providerIFormatProviderAn IFormatProvider that supplies culture-specific formatting information about
value.
Returns
- bool
trueif the specified value can be evaluated as a number; otherwise,false.
IsOdd(int)
Determines whether the specified value is an odd number.
public static bool IsOdd(int value)
Parameters
valueintThe value to evaluate.
Returns
- bool
trueif the specifiedvalueis an odd number; otherwise,false.
IsPrime(int)
Determines whether the specified value is a prime number.
public static bool IsPrime(int value)
Parameters
valueintThe positive integer to determine whether is a prime number.
Returns
- bool
trueif the specifiedvalueis a prime number; otherwise,false.
Exceptions
- ArgumentException
valuehas a value smaller than 0.
IsProtocolRelativeUrl(string, Action<ProtocolRelativeUriStringOptions>)
Determines whether the specified value is valid by attempting to construct a URI.
public static bool IsProtocolRelativeUrl(string value, Action<ProtocolRelativeUriStringOptions> setup = null)
Parameters
valuestringsetupAction<ProtocolRelativeUriStringOptions>The ProtocolRelativeUriStringOptions which may be configured.
Returns
- bool
trueif the specifiedvalueis a protocol relative URI; otherwise,false.
IsTrue(bool)
Determines whether the specified value is true.
public static bool IsTrue(bool value)
Parameters
valueboolThe value to verify is
true.
Returns
- bool
trueif the specifiedvalueistrue; otherwise,false.
IsTrue(bool, Action)
Invokes the delegate expression when value of condition is true.
public static void IsTrue(bool condition, Action expression)
Parameters
conditionboolWhen
true, theexpressiondelegate is invoked.expressionActionThe delegate that is invoked when
conditionistrue.
IsUri(string, Action<UriStringOptions>)
Determines whether the specified value is valid by attempting to construct a URI.
public static bool IsUri(string value, Action<UriStringOptions> setup = null)
Parameters
valuestringsetupAction<UriStringOptions>The UriStringOptions which may be configured.
Returns
- bool
trueif the specifiedvalueis a valid URI; otherwise,false.
IsWhiteSpace(string)
Determines whether the specified value consist only of white-space characters.
public static bool IsWhiteSpace(string value)
Parameters
valuestringThe string to verify consist only of white-space characters.
Returns
- bool
trueif the specifiedvalueconsist only of white-space characters; otherwise,false.
IsWithinRange<T>(T, T, T)
Determines whether the specified x is within range of min and max.
public static bool IsWithinRange<T>(T x, T min, T max) where T : struct, IConvertible
Parameters
xTThe object to compare.
minTThe minimum value of
x.maxTThe maximum value of
x.
Returns
- bool
trueifxis within range ofminandmax; otherwisefalse.
Type Parameters
TThe type of objects to compare.
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
conditionboolWhen
true, thefirstExpressionis invoked and becomes the result; whenfalse, thesecondExpressionis invoked and becomes the result.firstExpressionFunc<TResult>The function delegate that is invoked when
conditionistrue.secondExpressionFunc<TResult>The function delegate that is invoked when
conditionisfalse.
Returns
- TResult
The result of either function delegate
firstExpressionor function delegatesecondExpression.
Type Parameters
TResultThe 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
conditionboolWhen
true, thefirstExpressionis invoked and becomes the result; whenfalse, thesecondExpressionis invoked and becomes the result.firstExpressionFunc<T, TResult>The function delegate that is invoked when
conditionistrue.secondExpressionFunc<T, TResult>The function delegate that is invoked when
conditionisfalse.argTThe parameter of the function delegates
firstExpressionandsecondExpression.
Returns
- TResult
The result of either function delegate
firstExpressionor function delegatesecondExpression.
Type Parameters
TThe type of the parameter of the function delegates
firstExpressionandsecondExpression.TResultThe 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
conditionboolWhen
true, thefirstExpressionis invoked and becomes the result; whenfalse, thesecondExpressionis invoked and becomes the result.firstExpressionFunc<T1, T2, TResult>The function delegate that is invoked when
conditionistrue.secondExpressionFunc<T1, T2, TResult>The function delegate that is invoked when
conditionisfalse.arg1T1The first parameter of the function delegates
firstExpressionandsecondExpression.arg2T2The second parameter of the function delegates
firstExpressionandsecondExpression.
Returns
- TResult
The result of either function delegate
firstExpressionor function delegatesecondExpression.
Type Parameters
T1The type of the first parameter of the function delegates
firstExpressionandsecondExpression.T2The type of the second parameter of the function delegates
firstExpressionandsecondExpression.TResultThe 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
conditionboolWhen
true, thefirstExpressionis invoked and becomes the result; whenfalse, thesecondExpressionis invoked and becomes the result.firstExpressionFunc<T1, T2, T3, TResult>The function delegate that is invoked when
conditionistrue.secondExpressionFunc<T1, T2, T3, TResult>The function delegate that is invoked when
conditionisfalse.arg1T1The first parameter of the function delegates
firstExpressionandsecondExpression.arg2T2The second parameter of the function delegates
firstExpressionandsecondExpression.arg3T3The third parameter of the function delegates
firstExpressionandsecondExpression.
Returns
- TResult
The result of either function delegate
firstExpressionor function delegatesecondExpression.
Type Parameters
T1The type of the first parameter of the function delegates
firstExpressionandsecondExpression.T2The type of the second parameter of the function delegates
firstExpressionandsecondExpression.T3The type of the third parameter of the function delegates
firstExpressionandsecondExpression.TResultThe 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
conditionboolWhen
true, thefirstExpressionis invoked and becomes the result; whenfalse, thesecondExpressionis invoked and becomes the result.firstExpressionFunc<T1, T2, T3, T4, TResult>The function delegate that is invoked when
conditionistrue.secondExpressionFunc<T1, T2, T3, T4, TResult>The function delegate that is invoked when
conditionisfalse.arg1T1The first parameter of the function delegates
firstExpressionandsecondExpression.arg2T2The second parameter of the function delegates
firstExpressionandsecondExpression.arg3T3The third parameter of the function delegates
firstExpressionandsecondExpression.arg4T4The fourth parameter of the function delegates
firstExpressionandsecondExpression.
Returns
- TResult
The result of either function delegate
firstExpressionor function delegatesecondExpression.
Type Parameters
T1The type of the first parameter of the function delegates
firstExpressionandsecondExpression.T2The type of the second parameter of the function delegates
firstExpressionandsecondExpression.T3The type of the third parameter of the function delegates
firstExpressionandsecondExpression.T4The type of the fourth parameter of the function delegates
firstExpressionandsecondExpression.TResultThe 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
conditionboolWhen
true, thefirstExpressionis invoked and becomes the result; whenfalse, thesecondExpressionis invoked and becomes the result.firstExpressionFunc<T1, T2, T3, T4, T5, TResult>The function delegate that is invoked when
conditionistrue.secondExpressionFunc<T1, T2, T3, T4, T5, TResult>The function delegate that is invoked when
conditionisfalse.arg1T1The first parameter of the function delegates
firstExpressionandsecondExpression.arg2T2The second parameter of the function delegates
firstExpressionandsecondExpression.arg3T3The third parameter of the function delegates
firstExpressionandsecondExpression.arg4T4The fourth parameter of the function delegates
firstExpressionandsecondExpression.arg5T5The fifth parameter of the function delegates
firstExpressionandsecondExpression.
Returns
- TResult
The result of either function delegate
firstExpressionor function delegatesecondExpression.
Type Parameters
T1The type of the first parameter of the function delegates
firstExpressionandsecondExpression.T2The type of the second parameter of the function delegates
firstExpressionandsecondExpression.T3The type of the third parameter of the function delegates
firstExpressionandsecondExpression.T4The type of the fourth parameter of the function delegates
firstExpressionandsecondExpression.T5The type of the fifth parameter of the function delegates
firstExpressionandsecondExpression.TResultThe type of the result.