Class Validator
Provides a generic way to validate different types of arguments passed to members.
Inheritance
Namespace: Cuemon
Assembly: Cuemon.Core.dll
Syntax
public static class Validator
Methods
| Improve this DocThrowIf(Func<Boolean>, Func<String, String, Exception>, String, String)
Validates from the provided condition
.
An exception
is resolved and thrown if the condition
evaluates true
.
Declaration
public static void ThrowIf(Func<bool> condition, Func<string, string, Exception> exception, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
System. |
condition | The function delegate that determines if an |
System. |
exception | The function delegate that resolves the System. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIf<TValue>(TValue, Func<TValue, Boolean>, Func<String, String, Exception>, String, String)
Validates the specified value
from the provided condition
.
An exception
is resolved and thrown if the condition
evaluates true
.
Declaration
public static void ThrowIf<TValue>(TValue value, Func<TValue, bool> condition, Func<string, string, Exception> exception, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
TValue | value | The value that will be evaluated by |
System. |
condition | The function delegate that determines if an |
System. |
exception | The function delegate that resolves the System. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Type Parameters
Name | Description |
---|---|
TValue | The type of the value to evaluate. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIf<TValue, T>(TValue, Func<TValue, T, Boolean>, T, Func<String, String, Exception>, String, String)
Validates the specified value
from the provided condition
.
An exception
is resolved and thrown if the condition
evaluates true
.
Declaration
public static void ThrowIf<TValue, T>(TValue value, Func<TValue, T, bool> condition, T arg, Func<string, string, Exception> exception, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
TValue | value | The value that will be evaluated by |
System. |
condition | The function delegate that determines if an |
T | arg | The parameter of the function delegate |
System. |
exception | The function delegate that resolves the System. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Type Parameters
Name | Description |
---|---|
TValue | The type of the value to evaluate. |
T | The type of the parameter of the function delegate |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIf<TValue, T1, T2>(TValue, Func<TValue, T1, T2, Boolean>, T1, T2, Func<String, String, Exception>, String, String)
Validates the specified value
from the provided condition
.
An exception
is resolved and thrown if the condition
evaluates true
.
Declaration
public static void ThrowIf<TValue, T1, T2>(TValue value, Func<TValue, T1, T2, bool> condition, T1 arg1, T2 arg2, Func<string, string, Exception> exception, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
TValue | value | The value that will be evaluated by |
System. |
condition | The function delegate that determines if an |
T1 | arg1 | The first parameter of the function delegate |
T2 | arg2 | The second parameter of the function delegate |
System. |
exception | The function delegate that resolves the System. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Type Parameters
Name | Description |
---|---|
TValue | The type of the value to evaluate. |
T1 | The type of the first parameter of the function delegate |
T2 | The type of the second parameter of the function delegate |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIf<TValue, T1, T2, T3>(TValue, Func<TValue, T1, T2, T3, Boolean>, T1, T2, T3, Func<String, String, Exception>, String, String)
Validates the specified value
from the provided condition
.
An exception
is resolved and thrown if the condition
evaluates true
.
Declaration
public static void ThrowIf<TValue, T1, T2, T3>(TValue value, Func<TValue, T1, T2, T3, bool> condition, T1 arg1, T2 arg2, T3 arg3, Func<string, string, Exception> exception, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
TValue | value | The value that will be evaluated by |
System. |
condition | The function delegate that determines if an |
T1 | arg1 | The first parameter of the function delegate |
T2 | arg2 | The second parameter of the function delegate |
T3 | arg3 | The third parameter of the function delegate |
System. |
exception | The function delegate that resolves the System. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Type Parameters
Name | Description |
---|---|
TValue | The type of the value to evaluate. |
T1 | The type of the first parameter of the function delegate |
T2 | The type of the second parameter of the function delegate |
T3 | The type of the third parameter of the function delegate |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIf<TValue, T1, T2, T3, T4>(TValue, Func<TValue, T1, T2, T3, T4, Boolean>, T1, T2, T3, T4, Func<String, String, Exception>, String, String)
Validates the specified value
from the provided condition
.
An exception
is resolved and thrown if the condition
evaluates true
.
Declaration
public static void ThrowIf<TValue, T1, T2, T3, T4>(TValue value, Func<TValue, T1, T2, T3, T4, bool> condition, T1 arg1, T2 arg2, T3 arg3, T4 arg4, Func<string, string, Exception> exception, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
TValue | value | The value that will be evaluated by |
System. |
condition | The function delegate that determines if an |
T1 | arg1 | The first parameter of the function delegate |
T2 | arg2 | The second parameter of the function delegate |
T3 | arg3 | The third parameter of the function delegate |
T4 | arg4 | The fourth parameter of the function delegate |
System. |
exception | The function delegate that resolves the System. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Type Parameters
Name | Description |
---|---|
TValue | The type of the value to evaluate. |
T1 | The type of the first parameter of the function delegate |
T2 | The type of the second parameter of the function delegate |
T3 | The type of the third parameter of the function delegate |
T4 | The type of the fourth parameter of the function delegate |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIf<TValue, T1, T2, T3, T4, T5>(TValue, Func<TValue, T1, T2, T3, T4, T5, Boolean>, T1, T2, T3, T4, T5, Func<String, String, Exception>, String, String)
Validates the specified value
from the provided condition
.
An exception
is resolved and thrown if the condition
evaluates true
.
Declaration
public static void ThrowIf<TValue, T1, T2, T3, T4, T5>(TValue value, Func<TValue, T1, T2, T3, T4, T5, bool> condition, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, Func<string, string, Exception> exception, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
TValue | value | The value that will be evaluated by |
System. |
condition | The function delegate that determines if an |
T1 | arg1 | The first parameter of the function delegate |
T2 | arg2 | The second parameter of the function delegate |
T3 | arg3 | The third parameter of the function delegate |
T4 | arg4 | The fourth parameter of the function delegate |
T5 | arg5 | The fifth parameter of the function delegate |
System. |
exception | The function delegate that resolves the System. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Type Parameters
Name | Description |
---|---|
TValue | The type of the value to evaluate. |
T1 | The type of the first parameter of the function delegate |
T2 | The type of the second parameter of the function delegate |
T3 | The type of the third parameter of the function delegate |
T4 | The type of the fourth parameter of the function delegate |
T5 | The type of the fifth parameter of the function delegate |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfContainsType(Object, String, String, Type[])
Validates and throws an System.value
is contained within at least one of the specified types
.
Declaration
public static void ThrowIfContainsType(object value, string paramName, string message, params Type[] types)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
System. |
types | A variable number of System. |
Exceptions
Type | Condition |
---|---|
System. |
|
System. |
|
ThrowIfContainsType(Object, String, Type[])
Validates and throws an System.value
is contained within at least one of the specified types
.
Declaration
public static void ThrowIfContainsType(object value, string paramName, params Type[] types)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
types | A variable number of System. |
Exceptions
Type | Condition |
---|---|
System. |
|
System. |
|
ThrowIfContainsType(Type, String, String, Type[])
Validates and throws an System.value
is contained within at least one of the specified types
.
Declaration
public static void ThrowIfContainsType(Type value, string paramName, string message, params Type[] types)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
System. |
types | A variable number of System. |
Exceptions
Type | Condition |
---|---|
System. |
|
System. |
|
ThrowIfContainsType(Type, String, Type[])
Validates and throws an System.value
is contained within at least one of the specified types
.
Declaration
public static void ThrowIfContainsType(Type value, string paramName, params Type[] types)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
types | A variable number of System. |
Exceptions
Type | Condition |
---|---|
System. |
|
System. |
|
ThrowIfContainsType<T>(String, String, Type[])
Validates and throws an TypeT
is contained within at least one of the specified types
.
Declaration
public static void ThrowIfContainsType<T>(string typeParamName, string message, params Type[] types)
Parameters
Type | Name | Description |
---|---|---|
System. |
typeParamName | The name of the type parameter that caused the exception. |
System. |
message | A message that describes the error. |
System. |
types | A variable number of System. |
Type Parameters
Name | Description |
---|---|
T |
Exceptions
Type | Condition |
---|---|
System. |
|
Type |
|
ThrowIfContainsType<T>(String, Type[])
Validates and throws an TypeT
is contained within at least one of the specified types
.
Declaration
public static void ThrowIfContainsType<T>(string typeParamName, params Type[] types)
Parameters
Type | Name | Description |
---|---|---|
System. |
typeParamName | The name of the type parameter that caused the exception. |
System. |
types | A variable number of System. |
Type Parameters
Name | Description |
---|---|
T |
Exceptions
Type | Condition |
---|---|
System. |
|
Type |
|
ThrowIfDistinctDifference(String, String, String, String)
Validates and throws an System.arbitrary
and definite
.
Declaration
public static void ThrowIfDistinctDifference(string definite, string arbitrary, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
System. |
definite | The value that specifies valid characters. |
System. |
arbitrary | The value to distinctively compare with |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Exceptions
Type | Condition |
---|---|
System. |
There is a distinct difference between |
ThrowIfEmailAddress(String, String)
Validates and throws an System.value
has the format of an email address.
Declaration
public static void ThrowIfEmailAddress(string value, string paramName)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfEmailAddress(String, String, String)
Validates and throws an System.value
has the format of an email address.
Declaration
public static void ThrowIfEmailAddress(string value, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfEmpty(String, String)
Validates and throws an Argumentvalue
is empty.
Declaration
public static void ThrowIfEmpty(string value, string paramName)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
Exceptions
Type | Condition |
---|---|
Argument |
|
ThrowIfEmpty(String, String, String)
Validates and throws an Argumentvalue
is empty.
Declaration
public static void ThrowIfEmpty(string value, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Exceptions
Type | Condition |
---|---|
Argument |
|
ThrowIfEnum<TEnum>(String, Boolean, String)
Validates and throws an System.value
represents an enumeration.
Declaration
public static void ThrowIfEnum<TEnum>(string value, bool ignoreCase, string paramName)
where TEnum : struct, IConvertible
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
ignoreCase |
|
System. |
paramName | The name of the parameter that caused the exception. |
Type Parameters
Name | Description |
---|---|
TEnum | The type of the enumeration. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfEnum<TEnum>(String, Boolean, String, String)
Validates and throws an System.value
represents an enumeration.
Declaration
public static void ThrowIfEnum<TEnum>(string value, bool ignoreCase, string paramName, string message)
where TEnum : struct, IConvertible
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
ignoreCase |
|
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Type Parameters
Name | Description |
---|---|
TEnum | The type of the enumeration. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfEnum<TEnum>(String, String)
Validates and throws an System.value
represents an enumeration.
Declaration
public static void ThrowIfEnum<TEnum>(string value, string paramName)
where TEnum : struct, IConvertible
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
Type Parameters
Name | Description |
---|---|
TEnum | The type of the enumeration. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfEnumType<TEnum>(String)
Validates and throws an TypeTEnum
represents an enumeration.
Declaration
public static void ThrowIfEnumType<TEnum>(string typeParamName)
Parameters
Type | Name | Description |
---|---|---|
System. |
typeParamName | The name of the type parameter that caused the exception. |
Type Parameters
Name | Description |
---|---|
TEnum | The type to check is an enumeration. |
Exceptions
Type | Condition |
---|---|
Type |
|
ThrowIfEnumType<TEnum>(String, String)
Validates and throws an TypeTEnum
represents an enumeration.
Declaration
public static void ThrowIfEnumType<TEnum>(string typeParamName, string message)
Parameters
Type | Name | Description |
---|---|---|
System. |
typeParamName | The name of the type parameter that caused the exception. |
System. |
message | A message that describes the error. |
Type Parameters
Name | Description |
---|---|
TEnum | The type to check is an enumeration. |
Exceptions
Type | Condition |
---|---|
Type |
|
ThrowIfEqual<T>(T, T, IEqualityComparer<T>, String)
Validates and throws an System.x
object are equal to the y
object.
Declaration
public static void ThrowIfEqual<T>(T x, T y, IEqualityComparer<T> comparer, string paramName)
Parameters
Type | Name | Description |
---|---|---|
T | x | The first object to compare. |
T | y | The second object to compare. |
System. |
comparer | The System.Collections.Generic.IEqualityComparer<T> implementation to use when comparing |
System. |
paramName | The name of the parameter that caused the exception. |
Type Parameters
Name | Description |
---|---|
T | The type of objects to compare. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfEqual<T>(T, T, IEqualityComparer<T>, String, String)
Validates and throws an System.x
object are equal to the y
object.
Declaration
public static void ThrowIfEqual<T>(T x, T y, IEqualityComparer<T> comparer, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
T | x | The first object to compare. |
T | y | The second object to compare. |
System. |
comparer | The System.Collections.Generic.IEqualityComparer<T> implementation to use when comparing |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Type Parameters
Name | Description |
---|---|
T | The type of objects to compare. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfEqual<T>(T, T, String)
Validates and throws an System.x
object are equal to the y
object.
Declaration
public static void ThrowIfEqual<T>(T x, T y, string paramName)
Parameters
Type | Name | Description |
---|---|---|
T | x | The first object to compare. |
T | y | The second object to compare. |
System. |
paramName | The name of the parameter that caused the exception. |
Type Parameters
Name | Description |
---|---|
T | The type of objects to compare. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfEqual<T>(T, T, String, String)
Validates and throws an System.x
object are equal to the y
object.
Declaration
public static void ThrowIfEqual<T>(T x, T y, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
T | x | The first object to compare. |
T | y | The second object to compare. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Type Parameters
Name | Description |
---|---|
T | The type of objects to compare. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfFalse(Boolean, String)
Validates and throws an System.value
is false
.
Declaration
public static void ThrowIfFalse(bool value, string paramName)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfFalse(Boolean, String, String)
Validates and throws an System.value
is false
.
Declaration
public static void ThrowIfFalse(bool value, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfGreaterThan<T>(T, T, String)
Validates and throws an System.x
is greater than y
.
Declaration
public static void ThrowIfGreaterThan<T>(T x, T y, string paramName)
where T : struct, IConvertible
Parameters
Type | Name | Description |
---|---|---|
T | x | The first object to compare. |
T | y | The second object to compare. |
System. |
paramName | The name of the parameter that caused the exception. |
Type Parameters
Name | Description |
---|---|
T | The type of objects to compare. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfGreaterThan<T>(T, T, String, String)
Validates and throws an System.x
is greater than y
.
Declaration
public static void ThrowIfGreaterThan<T>(T x, T y, string paramName, string message)
where T : struct, IConvertible
Parameters
Type | Name | Description |
---|---|---|
T | x | The first object to compare. |
T | y | The second object to compare. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Type Parameters
Name | Description |
---|---|
T | The type of objects to compare. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfGreaterThanOrEqual<T>(T, T, String)
Validates and throws an System.x
is greater than or equal to y
.
Declaration
public static void ThrowIfGreaterThanOrEqual<T>(T x, T y, string paramName)
where T : struct, IConvertible
Parameters
Type | Name | Description |
---|---|---|
T | x | The first object to compare. |
T | y | The second object to compare. |
System. |
paramName | The name of the parameter that caused the exception. |
Type Parameters
Name | Description |
---|---|
T | The type of objects to compare. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfGreaterThanOrEqual<T>(T, T, String, String)
Validates and throws an System.x
is greater than or equal to y
.
Declaration
public static void ThrowIfGreaterThanOrEqual<T>(T x, T y, string paramName, string message)
where T : struct, IConvertible
Parameters
Type | Name | Description |
---|---|---|
T | x | The first object to compare. |
T | y | The second object to compare. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Type Parameters
Name | Description |
---|---|
T | The type of objects to compare. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfGuid(String, GuidFormats, String)
Validates and throws an System.value
has the format of a System.
Declaration
public static void ThrowIfGuid(string value, GuidFormats format, string paramName)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
Guid |
format | A bitmask comprised of one or more Guid |
System. |
paramName | The name of the parameter that caused the exception. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfGuid(String, GuidFormats, String, String)
Validates and throws an System.value
has the format of a System.
Declaration
public static void ThrowIfGuid(string value, GuidFormats format, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
Guid |
format | A bitmask comprised of one or more Guid |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfGuid(String, String)
Validates and throws an System.value
has the format of a System.
Declaration
public static void ThrowIfGuid(string value, string paramName)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
Remarks
This implementation only evaluates for GUID formats of: Digit
The reason not to include Number
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfHex(String, String)
Validates and throws an System.value
is hexadecimal.
Declaration
public static void ThrowIfHex(string value, string paramName)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfHex(String, String, String)
Validates and throws an System.value
is hexadecimal.
Declaration
public static void ThrowIfHex(string value, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfLowerThan<T>(T, T, String)
Validates and throws an System.x
is lower than y
.
Declaration
public static void ThrowIfLowerThan<T>(T x, T y, string paramName)
where T : struct, IConvertible
Parameters
Type | Name | Description |
---|---|---|
T | x | The first object to compare. |
T | y | The second object to compare. |
System. |
paramName | The name of the parameter that caused the exception. |
Type Parameters
Name | Description |
---|---|
T | The type of objects to compare. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfLowerThan<T>(T, T, String, String)
Validates and throws an System.x
is lower than y
.
Declaration
public static void ThrowIfLowerThan<T>(T x, T y, string paramName, string message)
where T : struct, IConvertible
Parameters
Type | Name | Description |
---|---|---|
T | x | The first object to compare. |
T | y | The second object to compare. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Type Parameters
Name | Description |
---|---|
T | The type of objects to compare. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfLowerThanOrEqual<T>(T, T, String)
Validates and throws an System.x
is lower than or equal to y
.
Declaration
public static void ThrowIfLowerThanOrEqual<T>(T x, T y, string paramName)
where T : struct, IConvertible
Parameters
Type | Name | Description |
---|---|---|
T | x | The first object to compare. |
T | y | The second object to compare. |
System. |
paramName | The name of the parameter that caused the exception. |
Type Parameters
Name | Description |
---|---|
T | The type of objects to compare. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfLowerThanOrEqual<T>(T, T, String, String)
Validates and throws an System.x
is lower than or equal to y
.
Declaration
public static void ThrowIfLowerThanOrEqual<T>(T x, T y, string paramName, string message)
where T : struct, IConvertible
Parameters
Type | Name | Description |
---|---|---|
T | x | The first object to compare. |
T | y | The second object to compare. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Type Parameters
Name | Description |
---|---|
T | The type of objects to compare. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNot(Func<Boolean>, Func<String, String, Exception>, String, String)
Validates from the provided condition
.
An exception
is resolved and thrown if the condition
evaluates false
.
Declaration
public static void ThrowIfNot(Func<bool> condition, Func<string, string, Exception> exception, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
System. |
condition | The function delegate that determines if an |
System. |
exception | The function delegate that resolves the System. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNot<TValue>(TValue, Func<TValue, Boolean>, Func<String, String, Exception>, String, String)
Validates the specified value
from the provided condition
.
An exception
is resolved and thrown if the condition
evaluates false
.
Declaration
public static void ThrowIfNot<TValue>(TValue value, Func<TValue, bool> condition, Func<string, string, Exception> exception, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
TValue | value | The value that will be evaluated by |
System. |
condition | The function delegate that determines if an |
System. |
exception | The function delegate that resolves the System. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Type Parameters
Name | Description |
---|---|
TValue | The type of the value to evaluate. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNot<TValue, T>(TValue, Func<TValue, T, Boolean>, T, Func<String, String, Exception>, String, String)
Validates the specified value
from the provided condition
.
An exception
is resolved and thrown if the condition
evaluates false
.
Declaration
public static void ThrowIfNot<TValue, T>(TValue value, Func<TValue, T, bool> condition, T arg, Func<string, string, Exception> exception, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
TValue | value | The value that will be evaluated by |
System. |
condition | The function delegate that determines if an |
T | arg | The parameter of the function delegate |
System. |
exception | The function delegate that resolves the System. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Type Parameters
Name | Description |
---|---|
TValue | The type of the value to evaluate. |
T | The type of the parameter of the function delegate |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNot<TValue, T1, T2>(TValue, Func<TValue, T1, T2, Boolean>, T1, T2, Func<String, String, Exception>, String, String)
Validates the specified value
from the provided condition
.
An exception
is resolved and thrown if the condition
evaluates false
.
Declaration
public static void ThrowIfNot<TValue, T1, T2>(TValue value, Func<TValue, T1, T2, bool> condition, T1 arg1, T2 arg2, Func<string, string, Exception> exception, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
TValue | value | The value that will be evaluated by |
System. |
condition | The function delegate that determines if an |
T1 | arg1 | The first parameter of the function delegate |
T2 | arg2 | The second parameter of the function delegate |
System. |
exception | The function delegate that resolves the System. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Type Parameters
Name | Description |
---|---|
TValue | The type of the value to evaluate. |
T1 | The type of the first parameter of the function delegate |
T2 | The type of the second parameter of the function delegate |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNot<TValue, T1, T2, T3>(TValue, Func<TValue, T1, T2, T3, Boolean>, T1, T2, T3, Func<String, String, Exception>, String, String)
Validates the specified value
from the provided condition
.
An exception
is resolved and thrown if the condition
evaluates false
.
Declaration
public static void ThrowIfNot<TValue, T1, T2, T3>(TValue value, Func<TValue, T1, T2, T3, bool> condition, T1 arg1, T2 arg2, T3 arg3, Func<string, string, Exception> exception, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
TValue | value | The value that will be evaluated by |
System. |
condition | The function delegate that determines if an |
T1 | arg1 | The first parameter of the function delegate |
T2 | arg2 | The second parameter of the function delegate |
T3 | arg3 | The third parameter of the function delegate |
System. |
exception | The function delegate that resolves the System. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Type Parameters
Name | Description |
---|---|
TValue | The type of the value to evaluate. |
T1 | The type of the first parameter of the function delegate |
T2 | The type of the second parameter of the function delegate |
T3 | The type of the third parameter of the function delegate |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNot<TValue, T1, T2, T3, T4>(TValue, Func<TValue, T1, T2, T3, T4, Boolean>, T1, T2, T3, T4, Func<String, String, Exception>, String, String)
Validates the specified value
from the provided condition
.
An exception
is resolved and thrown if the condition
evaluates false
.
Declaration
public static void ThrowIfNot<TValue, T1, T2, T3, T4>(TValue value, Func<TValue, T1, T2, T3, T4, bool> condition, T1 arg1, T2 arg2, T3 arg3, T4 arg4, Func<string, string, Exception> exception, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
TValue | value | The value that will be evaluated by |
System. |
condition | The function delegate that determines if an |
T1 | arg1 | The first parameter of the function delegate |
T2 | arg2 | The second parameter of the function delegate |
T3 | arg3 | The third parameter of the function delegate |
T4 | arg4 | The fourth parameter of the function delegate |
System. |
exception | The function delegate that resolves the System. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Type Parameters
Name | Description |
---|---|
TValue | The type of the value to evaluate. |
T1 | The type of the first parameter of the function delegate |
T2 | The type of the second parameter of the function delegate |
T3 | The type of the third parameter of the function delegate |
T4 | The type of the fourth parameter of the function delegate |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNot<TValue, T1, T2, T3, T4, T5>(TValue, Func<TValue, T1, T2, T3, T4, T5, Boolean>, T1, T2, T3, T4, T5, Func<String, String, Exception>, String, String)
Validates the specified value
from the provided condition
.
An exception
is resolved and thrown if the condition
evaluates false
.
Declaration
public static void ThrowIfNot<TValue, T1, T2, T3, T4, T5>(TValue value, Func<TValue, T1, T2, T3, T4, T5, bool> condition, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, Func<string, string, Exception> exception, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
TValue | value | The value that will be evaluated by |
System. |
condition | The function delegate that determines if an |
T1 | arg1 | The first parameter of the function delegate |
T2 | arg2 | The second parameter of the function delegate |
T3 | arg3 | The third parameter of the function delegate |
T4 | arg4 | The fourth parameter of the function delegate |
T5 | arg5 | The fifth parameter of the function delegate |
System. |
exception | The function delegate that resolves the System. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Type Parameters
Name | Description |
---|---|
TValue | The type of the value to evaluate. |
T1 | The type of the first parameter of the function delegate |
T2 | The type of the second parameter of the function delegate |
T3 | The type of the third parameter of the function delegate |
T4 | The type of the fourth parameter of the function delegate |
T5 | The type of the fifth parameter of the function delegate |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNotContainsType(Object, String, String, Type[])
Validates and throws an System.value
is not contained within at least one of the specified types
.
Declaration
public static void ThrowIfNotContainsType(object value, string paramName, string message, params Type[] types)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
System. |
types | A variable number of System. |
Exceptions
Type | Condition |
---|---|
System. |
|
System. |
|
ThrowIfNotContainsType(Object, String, Type[])
Validates and throws an System.value
is not contained within at least one of the specified types
.
Declaration
public static void ThrowIfNotContainsType(object value, string paramName, params Type[] types)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
types | A variable number of System. |
Exceptions
Type | Condition |
---|---|
System. |
|
System. |
|
ThrowIfNotContainsType(Type, String, String, Type[])
Validates and throws an System.value
is not contained within at least one of the specified types
.
Declaration
public static void ThrowIfNotContainsType(Type value, string paramName, string message, params Type[] types)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
System. |
types | A variable number of System. |
Exceptions
Type | Condition |
---|---|
System. |
|
System. |
|
ThrowIfNotContainsType(Type, String, Type[])
Validates and throws an System.value
is not contained within at least one of the specified types
.
Declaration
public static void ThrowIfNotContainsType(Type value, string paramName, params Type[] types)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
types | A variable number of System. |
Exceptions
Type | Condition |
---|---|
System. |
|
System. |
|
ThrowIfNotContainsType<T>(String, String, Type[])
Validates and throws an TypeT
is not contained within at least one of the specified types
.
Declaration
public static void ThrowIfNotContainsType<T>(string typeParamName, string message, params Type[] types)
Parameters
Type | Name | Description |
---|---|---|
System. |
typeParamName | The name of the type parameter that caused the exception. |
System. |
message | A message that describes the error. |
System. |
types | A variable number of System. |
Type Parameters
Name | Description |
---|---|
T |
Exceptions
Type | Condition |
---|---|
System. |
|
Type |
|
ThrowIfNotContainsType<T>(String, Type[])
Validates and throws an TypeT
is not contained within at least one of the specified types
.
Declaration
public static void ThrowIfNotContainsType<T>(string typeParamName, params Type[] types)
Parameters
Type | Name | Description |
---|---|---|
System. |
typeParamName | The name of the type parameter that caused the exception. |
System. |
types | A variable number of System. |
Type Parameters
Name | Description |
---|---|
T |
Exceptions
Type | Condition |
---|---|
System. |
|
Type |
|
ThrowIfNotDistinctDifference(String, String, String, String)
Validates and throws an System.arbitrary
and definite
.
Declaration
public static void ThrowIfNotDistinctDifference(string definite, string arbitrary, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
System. |
definite | The value that specifies valid characters. |
System. |
arbitrary | The value to distinctively compare with |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Exceptions
Type | Condition |
---|---|
System. |
There is not a distinct difference between |
ThrowIfNotEmailAddress(String, String)
Validates and throws an System.value
does not have the format of an email address.
Declaration
public static void ThrowIfNotEmailAddress(string value, string paramName)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNotEmailAddress(String, String, String)
Validates and throws an System.value
does not have the format of an email address.
Declaration
public static void ThrowIfNotEmailAddress(string value, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNotEnum<TEnum>(String, Boolean, String)
Validates and throws an System.value
does not represents an enumeration.
Declaration
public static void ThrowIfNotEnum<TEnum>(string value, bool ignoreCase, string paramName)
where TEnum : struct, IConvertible
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
ignoreCase |
|
System. |
paramName | The name of the parameter that caused the exception. |
Type Parameters
Name | Description |
---|---|
TEnum | The type of the enumeration. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNotEnum<TEnum>(String, Boolean, String, String)
Validates and throws an System.value
does not represents an enumeration.
Declaration
public static void ThrowIfNotEnum<TEnum>(string value, bool ignoreCase, string paramName, string message)
where TEnum : struct, IConvertible
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
ignoreCase |
|
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Type Parameters
Name | Description |
---|---|
TEnum | The type of the enumeration. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNotEnum<TEnum>(String, String)
Validates and throws an System.value
does not represents an enumeration.
Declaration
public static void ThrowIfNotEnum<TEnum>(string value, string paramName)
where TEnum : struct, IConvertible
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
Type Parameters
Name | Description |
---|---|
TEnum | The type of the enumeration. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNotEnumType<TEnum>(String)
Validates and throws an TypeTEnum
does not represents an enumeration.
Declaration
public static void ThrowIfNotEnumType<TEnum>(string typeParamName)
Parameters
Type | Name | Description |
---|---|---|
System. |
typeParamName | The name of the type parameter that caused the exception. |
Type Parameters
Name | Description |
---|---|
TEnum | The type to check is not an enumeration. |
Exceptions
Type | Condition |
---|---|
Type |
|
ThrowIfNotEnumType<TEnum>(String, String)
Validates and throws an TypeTEnum
does not represents an enumeration.
Declaration
public static void ThrowIfNotEnumType<TEnum>(string typeParamName, string message)
Parameters
Type | Name | Description |
---|---|---|
System. |
typeParamName | The name of the type parameter that caused the exception. |
System. |
message | A message that describes the error. |
Type Parameters
Name | Description |
---|---|
TEnum | The type to check is not an enumeration. |
Exceptions
Type | Condition |
---|---|
Type |
|
ThrowIfNotEqual<T>(T, T, IEqualityComparer<T>, String)
Validates and throws an System.x
object are not equal to the y
object.
Declaration
public static void ThrowIfNotEqual<T>(T x, T y, IEqualityComparer<T> comparer, string paramName)
Parameters
Type | Name | Description |
---|---|---|
T | x | The first object to compare. |
T | y | The second object to compare. |
System. |
comparer | The System.Collections.Generic.IEqualityComparer<T> implementation to use when comparing |
System. |
paramName | The name of the parameter that caused the exception. |
Type Parameters
Name | Description |
---|---|
T | The type of objects to compare. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNotEqual<T>(T, T, IEqualityComparer<T>, String, String)
Validates and throws an System.x
object are not equal to the y
object.
Declaration
public static void ThrowIfNotEqual<T>(T x, T y, IEqualityComparer<T> comparer, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
T | x | The first object to compare. |
T | y | The second object to compare. |
System. |
comparer | The System.Collections.Generic.IEqualityComparer<T> implementation to use when comparing |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Type Parameters
Name | Description |
---|---|
T | The type of objects to compare. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNotEqual<T>(T, T, String)
Validates and throws an System.x
object are not equal to the y
object.
Declaration
public static void ThrowIfNotEqual<T>(T x, T y, string paramName)
Parameters
Type | Name | Description |
---|---|---|
T | x | The first object to compare. |
T | y | The second object to compare. |
System. |
paramName | The name of the parameter that caused the exception. |
Type Parameters
Name | Description |
---|---|
T | The type of objects to compare. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNotEqual<T>(T, T, String, String)
Validates and throws an System.x
object are not equal to the y
object.
Declaration
public static void ThrowIfNotEqual<T>(T x, T y, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
T | x | The first object to compare. |
T | y | The second object to compare. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Type Parameters
Name | Description |
---|---|
T | The type of objects to compare. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNotGuid(String, GuidFormats, String)
Validates and throws an System.value
does not have the format of a System.
Declaration
public static void ThrowIfNotGuid(string value, GuidFormats format, string paramName)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
Guid |
format | A bitmask comprised of one or more Guid |
System. |
paramName | The name of the parameter that caused the exception. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNotGuid(String, GuidFormats, String, String)
Validates and throws an System.value
does not have the format of a System.
Declaration
public static void ThrowIfNotGuid(string value, GuidFormats format, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
Guid |
format | A bitmask comprised of one or more Guid |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNotGuid(String, String)
Validates and throws an System.value
does not have the format of a System.
Declaration
public static void ThrowIfNotGuid(string value, string paramName)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
Remarks
This implementation only evaluates for GUID formats of: Digit
The reason not to include Number
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNotHex(String, String)
Validates and throws an System.value
is not hexadecimal.
Declaration
public static void ThrowIfNotHex(string value, string paramName)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNotHex(String, String, String)
Validates and throws an System.value
is not hexadecimal.
Declaration
public static void ThrowIfNotHex(string value, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNotNumber(String, String)
Validates and throws an System.value
is not a number.
Declaration
public static void ThrowIfNotNumber(string value, string paramName)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNotNumber(String, String, NumberStyles)
Validates and throws an System.value
is not a number.
Declaration
public static void ThrowIfNotNumber(string value, string paramName, NumberStyles styles)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
styles | A bitwise combination of System. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNotNumber(String, String, NumberStyles, IFormatProvider)
Validates and throws an System.value
is not a number.
Declaration
public static void ThrowIfNotNumber(string value, string paramName, NumberStyles styles, IFormatProvider provider)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
styles | A bitwise combination of System. |
System. |
provider | An System. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNotNumber(String, String, String)
Validates and throws an System.value
is not a number.
Declaration
public static void ThrowIfNotNumber(string value, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNotNumber(String, String, String, NumberStyles)
Validates and throws an System.value
is not a number.
Declaration
public static void ThrowIfNotNumber(string value, string paramName, string message, NumberStyles styles)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
System. |
styles | A bitwise combination of System. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNotNumber(String, String, String, NumberStyles, IFormatProvider)
Validates and throws an System.value
is not a number.
Declaration
public static void ThrowIfNotNumber(string value, string paramName, string message, NumberStyles styles, IFormatProvider provider)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
System. |
styles | A bitwise combination of System. |
System. |
provider | An System. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNotSame<T>(T, T, String)
Validates and throws an System.x
object are not of the same instance as the y
object.
Declaration
public static void ThrowIfNotSame<T>(T x, T y, string paramName)
Parameters
Type | Name | Description |
---|---|---|
T | x | The first object to compare. |
T | y | The second object to compare. |
System. |
paramName | The name of the parameter that caused the exception. |
Type Parameters
Name | Description |
---|---|
T | The type of objects to compare. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNotSame<T>(T, T, String, String)
Validates and throws an System.x
object are not of the same instance as the y
object.
Declaration
public static void ThrowIfNotSame<T>(T x, T y, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
T | x | The first object to compare. |
T | y | The second object to compare. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Type Parameters
Name | Description |
---|---|
T | The type of objects to compare. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNotUri(String, String)
Validates and throws an System.value
does not have the format of an System.
Declaration
public static void ThrowIfNotUri(string value, string paramName)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNotUri(String, UriKind, String, String)
Validates and throws an System.value
does not have the format of an System.
Declaration
public static void ThrowIfNotUri(string value, UriKind uriKind, string paramName, string message = "Value must be an URI.")
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
uriKind | The type of the URI. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNull<T>(T, String)
Validates and throws an System.value
is null.
Declaration
public static void ThrowIfNull<T>(T value, string paramName)
Parameters
Type | Name | Description |
---|---|---|
T | value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
Type Parameters
Name | Description |
---|---|
T |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNull<T>(T, String, String)
Validates and throws an System.value
is null.
Declaration
public static void ThrowIfNull<T>(T value, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
T | value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Type Parameters
Name | Description |
---|---|
T |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNullOrEmpty(String, String)
Validates and throws either an System.value
is respectively null or empty.
Declaration
public static void ThrowIfNullOrEmpty(string value, string paramName)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
Exceptions
Type | Condition |
---|---|
System. |
|
Argument |
|
ThrowIfNullOrEmpty(String, String, String)
Validates and throws either an System.value
is respectively null or empty.
Declaration
public static void ThrowIfNullOrEmpty(string value, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Exceptions
Type | Condition |
---|---|
System. |
|
Argument |
|
ThrowIfNullOrWhitespace(String, String)
Validates and throws either an System.value
is respectively null, empty or consist only of white-space characters.
Declaration
public static void ThrowIfNullOrWhitespace(string value, string paramName)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
Exceptions
Type | Condition |
---|---|
System. |
|
Argument |
|
System. |
|
ThrowIfNullOrWhitespace(String, String, String)
Validates and throws either an System.value
is respectively null, empty or consist only of white-space characters.
Declaration
public static void ThrowIfNullOrWhitespace(string value, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Exceptions
Type | Condition |
---|---|
System. |
|
Argument |
|
System. |
|
ThrowIfNumber(String, String)
Validates and throws an System.value
is a number.
Declaration
public static void ThrowIfNumber(string value, string paramName)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNumber(String, String, NumberStyles)
Validates and throws an System.value
is a number.
Declaration
public static void ThrowIfNumber(string value, string paramName, NumberStyles styles)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
styles | A bitwise combination of System. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNumber(String, String, NumberStyles, IFormatProvider)
Validates and throws an System.value
is a number.
Declaration
public static void ThrowIfNumber(string value, string paramName, NumberStyles styles, IFormatProvider provider)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
styles | A bitwise combination of System. |
System. |
provider | An System. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNumber(String, String, String)
Validates and throws an System.value
is a number.
Declaration
public static void ThrowIfNumber(string value, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNumber(String, String, String, NumberStyles)
Validates and throws an System.value
is a number.
Declaration
public static void ThrowIfNumber(string value, string paramName, string message, NumberStyles styles)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
System. |
styles | A bitwise combination of System. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfNumber(String, String, String, NumberStyles, IFormatProvider)
Validates and throws an System.value
is a number.
Declaration
public static void ThrowIfNumber(string value, string paramName, string message, NumberStyles styles, IFormatProvider provider)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
System. |
styles | A bitwise combination of System. |
System. |
provider | An System. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfSame<T>(T, T, String)
Validates and throws an System.x
object are of the same instance as the y
object.
Declaration
public static void ThrowIfSame<T>(T x, T y, string paramName)
Parameters
Type | Name | Description |
---|---|---|
T | x | The first object to compare. |
T | y | The second object to compare. |
System. |
paramName | The name of the parameter that caused the exception. |
Type Parameters
Name | Description |
---|---|
T | The type of objects to compare. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfSame<T>(T, T, String, String)
Validates and throws an System.x
object are of the same instance as the y
object.
Declaration
public static void ThrowIfSame<T>(T x, T y, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
T | x | The first object to compare. |
T | y | The second object to compare. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Type Parameters
Name | Description |
---|---|
T | The type of objects to compare. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfTrue(Boolean, String)
Validates and throws an System.value
is true
.
Declaration
public static void ThrowIfTrue(bool value, string paramName)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfTrue(Boolean, String, String)
Validates and throws an System.value
is true
.
Declaration
public static void ThrowIfTrue(bool value, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfUri(String, String)
Validates and throws an System.value
has the format of an System.
Declaration
public static void ThrowIfUri(string value, string paramName)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfUri(String, UriKind, String, String)
Validates and throws an System.value
has the format of an System.
Declaration
public static void ThrowIfUri(string value, UriKind uriKind, string paramName, string message = "Value cannot be an URI.")
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
uriKind | The type of the URI. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfWhiteSpace(String, String)
Validates and throws an Argumentvalue
consist only of white-space characters.
Declaration
public static void ThrowIfWhiteSpace(string value, string paramName)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
Exceptions
Type | Condition |
---|---|
System. |
|
ThrowIfWhiteSpace(String, String, String)
Validates and throws an System.value
consist only of white-space characters.
Declaration
public static void ThrowIfWhiteSpace(string value, string paramName, string message)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value to be evaluated. |
System. |
paramName | The name of the parameter that caused the exception. |
System. |
message | A message that describes the error. |
Exceptions
Type | Condition |
---|---|
System. |
|