ValidationHelper Class
Provides helpful methods for validating data.
public static class ValidationHelper
- Inheritance:
- object object
Methods
ValidateDoubleIsBetweenInclusive(object, double, double)
Validates that the object is a double whose value is inclusively between two numbers.
public static bool ValidateDoubleIsBetweenInclusive(object value, double min, double max)
Parameter | Type | Description |
---|---|---|
value | object | The object to validate. |
min | double | The number that the value must be greater than or equal to. |
max | double | The number that the value must be less than or equal to. |
Returns
- bool:
true
if the validation is successful; otherwise,false
.
ValidateDoubleIsGreaterThan(object, double)
Validates that the object is a double greater than the specified number.
public static bool ValidateDoubleIsGreaterThan(object value, double min)
Parameter | Type | Description |
---|---|---|
value | object | The object to validate. |
min | double | The number that the value must be greater than. |
Returns
- bool:
true
if the validation is successful; otherwise,false
.
ValidateDoubleIsGreaterThanOrEqual(object, double)
Validates that the object is a double greater than or equal to the specified number.
public static bool ValidateDoubleIsGreaterThanOrEqual(object value, double min)
Parameter | Type | Description |
---|---|---|
value | object | The object to validate. |
min | double | The number that the value must be greater than or equal to. |
Returns
- bool:
true
if the validation is successful; otherwise,false
.
ValidateDoubleIsNumber(object)
Validates that the object is a double is not NaN
or infinity.
public static bool ValidateDoubleIsNumber(object value)
Parameter | Type | Description |
---|---|---|
value | object | The object to validate. |
Returns
- bool:
true
if the validation is successful; otherwise,false
.
ValidateDoubleIsNumberOrNaN(object)
Validates that the object is a double is not infinity.
public static bool ValidateDoubleIsNumberOrNaN(object value)
Parameter | Type | Description |
---|---|---|
value | object | The object to validate. |
Returns
- bool:
true
if the validation is successful; otherwise,false
.
ValidateDoubleIsPercentage(object)
Validates that the object is a double between 0
and 1
inclusive.
public static bool ValidateDoubleIsPercentage(object value)
Parameter | Type | Description |
---|---|---|
value | object | The object to validate. |
Returns
- bool:
true
if the validation is successful; otherwise,false
.
ValidateDoubleIsPositive(object)
Validates that the object is a double greater than or equal to 0
.
public static bool ValidateDoubleIsPositive(object value)
Parameter | Type | Description |
---|---|---|
value | object | The object to validate. |
Returns
- bool:
true
if the validation is successful; otherwise,false
.
ValidateDoubleIsPositiveOrNaN(object)
Validates that the object is a double greater than or equal to 0
or NaN
.
public static bool ValidateDoubleIsPositiveOrNaN(object value)
Parameter | Type | Description |
---|---|---|
value | object | The object to validate. |
Returns
- bool:
true
if the validation is successful; otherwise,false
.
ValidateDurationIsPositiveTimeSpan(object)
public static bool ValidateDurationIsPositiveTimeSpan(object value)
Parameter | Type | Description |
---|---|---|
value | object | The object to validate. |
Returns
- bool:
true
if the validation is successful; otherwise,false
.
ValidateInt32IsBetweenInclusive(object, int, int)
Validates that the object is an int whose value is inclusively between two numbers.
public static bool ValidateInt32IsBetweenInclusive(object value, int min, int max)
Parameter | Type | Description |
---|---|---|
value | object | The object to validate. |
min | int | The number that the value must be greater than or equal to. |
max | int | The number that the value must be less than or equal to. |
Returns
- bool:
true
if the validation is successful; otherwise,false
.
ValidateInt32IsGreaterThanOrEqual(object, int)
Validates that the object is an int greater than or equal to the specified number.
public static bool ValidateInt32IsGreaterThanOrEqual(object value, int min)
Parameter | Type | Description |
---|---|---|
value | object | The object to validate. |
min | int | The number that the value must be greater than or equal to. |
Returns
- bool:
true
if the validation is successful; otherwise,false
.
ValidateInt32IsPositive(object)
Validates that the object is an int greater than or equal to 0
.
public static bool ValidateInt32IsPositive(object value)
Parameter | Type | Description |
---|---|---|
value | object | The object to validate. |
Returns
- bool:
true
if the validation is successful; otherwise,false
.
ValidateInt64IsBetweenInclusive(object, long, long)
Validates that the object is an long whose value is inclusively between two numbers.
public static bool ValidateInt64IsBetweenInclusive(object value, long min, long max)
Parameter | Type | Description |
---|---|---|
value | object | The object to validate. |
min | long | The number that the value must be greater than or equal to. |
max | long | The number that the value must be less than or equal to. |
Returns
- bool:
true
if the validation is successful; otherwise,false
.
ValidateInt64IsGreaterThanOrEqual(object, long)
Validates that the object is an long greater than or equal to the specified number.
public static bool ValidateInt64IsGreaterThanOrEqual(object value, long min)
Parameter | Type | Description |
---|---|---|
value | object | The object to validate. |
min | long | The number that the value must be greater than or equal to. |
Returns
- bool:
true
if the validation is successful; otherwise,false
.
ValidateInt64IsPositive(object)
Validates that the object is an long greater than or equal to 0
.
public static bool ValidateInt64IsPositive(object value)
Parameter | Type | Description |
---|---|---|
value | object | The object to validate. |
Returns
- bool:
true
if the validation is successful; otherwise,false
.