Class NumericValidationExtensions
- Namespace
- Admonish
- Assembly
- Admonish.dll
Contains numeric validation extension methods of ValidationResult.
public static class NumericValidationExtensions
- Inheritance
-
NumericValidationExtensions
- Inherited Members
Methods
Between(ValidationResult, string, decimal, decimal, decimal, string?)
Ensures that the specified number is within the specified range (inclusive). When the check fails, adds an error message to the ValidationResult and associates it with the specified key.
public static ValidationResult Between(this ValidationResult r, string key, decimal value, decimal minValue, decimal maxValue, string? message = null)
Parameters
r
ValidationResultThe validation result.
key
stringThe key to associate the error with.
value
decimalThe number to check.
minValue
decimalThe minimum allowed value.
maxValue
decimalThe maximum allowed value.
message
stringAn optional error message.
Returns
- ValidationResult
The validation result.
Between(ValidationResult, string, int, int, int, string?)
Ensures that the specified number is within the specified range (inclusive). When the check fails, adds an error message to the ValidationResult and associates it with the specified key.
public static ValidationResult Between(this ValidationResult r, string key, int value, int minValue, int maxValue, string? message = null)
Parameters
r
ValidationResultThe validation result.
key
stringThe key to associate the error with.
value
intThe number to check.
minValue
intThe minimum allowed value.
maxValue
intThe maximum allowed value.
message
stringAn optional error message.
Returns
- ValidationResult
The validation result.
Max(ValidationResult, string, decimal, decimal, string?)
Ensures that the specified number is less than or equal to the specified value. When the check fails, adds an error message to the ValidationResult and associates it with the specified key.
public static ValidationResult Max(this ValidationResult r, string key, decimal value, decimal maxValue, string? message = null)
Parameters
r
ValidationResultThe validation result.
key
stringThe key to associate the error with.
value
decimalThe number to check.
maxValue
decimalThe maximum allowed value.
message
stringAn optional error message.
Returns
- ValidationResult
The validation result.
Max(ValidationResult, string, int, int, string?)
Ensures that the specified number is less than or equal to the specified value. When the check fails, adds an error message to the ValidationResult and associates it with the specified key.
public static ValidationResult Max(this ValidationResult r, string key, int value, int maxValue, string? message = null)
Parameters
r
ValidationResultThe validation result.
key
stringThe key to associate the error with.
value
intThe number to check.
maxValue
intThe maximum allowed value.
message
stringAn optional error message.
Returns
- ValidationResult
The validation result.
Min(ValidationResult, string, decimal, decimal, string?)
Ensures that the specified number is greater than or equal to the specified value. When the check fails, adds an error message to the ValidationResult and associates it with the specified key.
public static ValidationResult Min(this ValidationResult r, string key, decimal value, decimal minValue, string? message = null)
Parameters
r
ValidationResultThe validation result.
key
stringThe key to associate the error with.
value
decimalThe number to check.
minValue
decimalThe minimum allowed value.
message
stringAn optional error message.
Returns
- ValidationResult
The validation result.
Min(ValidationResult, string, int, int, string?)
Ensures that the specified number is greater than or equal to the specified value. When the check fails, adds an error message to the ValidationResult and associates it with the specified key.
public static ValidationResult Min(this ValidationResult r, string key, int value, int minValue, string? message = null)
Parameters
r
ValidationResultThe validation result.
key
stringThe key to associate the error with.
value
intThe number to check.
minValue
intThe minimum allowed value.
message
stringAn optional error message.
Returns
- ValidationResult
The validation result.