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
rValidationResultThe validation result.
keystringThe key to associate the error with.
valuedecimalThe number to check.
minValuedecimalThe minimum allowed value.
maxValuedecimalThe maximum allowed value.
messagestringAn 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
rValidationResultThe validation result.
keystringThe key to associate the error with.
valueintThe number to check.
minValueintThe minimum allowed value.
maxValueintThe maximum allowed value.
messagestringAn 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
rValidationResultThe validation result.
keystringThe key to associate the error with.
valuedecimalThe number to check.
maxValuedecimalThe maximum allowed value.
messagestringAn 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
rValidationResultThe validation result.
keystringThe key to associate the error with.
valueintThe number to check.
maxValueintThe maximum allowed value.
messagestringAn 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
rValidationResultThe validation result.
keystringThe key to associate the error with.
valuedecimalThe number to check.
minValuedecimalThe minimum allowed value.
messagestringAn 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
rValidationResultThe validation result.
keystringThe key to associate the error with.
valueintThe number to check.
minValueintThe minimum allowed value.
messagestringAn optional error message.
Returns
- ValidationResult
The validation result.