Class IntegerValidator
- Namespace
- CloudyWing.FormValidators
- Assembly
- CloudyWing.FormValidators.dll
Validation constrains the integer format of a value.
public sealed class IntegerValidator : ComparableTypeValidator<long>, IFormValidator
- Inheritance
-
IntegerValidator
- Implements
- Inherited Members
Constructors
IntegerValidator(string, string, bool, Func<string, string, long?, long?, string>)
Initializes a new instance of the IntegerValidator class.
public IntegerValidator(string column, string value, bool allowedThousands = false, Func<string, string, long?, long?, string> customErrorMessageAccessor = null)
Parameters
columnstringThe column.
valuestringThe value.
allowedThousandsboolcustomErrorMessageAccessorFunc<string, string, long?, long?, string>The custom error message accessor. The arguments are column, value, min, max.
IntegerValidator(string, string, long?, long?, bool, Func<string, string, long?, long?, string>)
Initializes a new instance of the IntegerValidator class.
public IntegerValidator(string column, string value, long? min, long? max, bool allowedThousands = false, Func<string, string, long?, long?, string> customErrorMessageAccessor = null)
Parameters
columnstringThe column.
valuestringThe value.
minlong?The minimum.
maxlong?The maximum.
allowedThousandsboolif set to
true[allowed thousands].customErrorMessageAccessorFunc<string, string, long?, long?, string>The custom error message accessor.
Properties
AllowedThousands
Gets a value indicating whether [allowed thousands].
public bool AllowedThousands { get; }
Property Value
- bool
trueif [allowed thousands]; otherwise,false.
CastErrorMessageAccessor
Gets the cast error message accessor.
protected override Func<string, string, string> CastErrorMessageAccessor { get; }
Property Value
Methods
TryParse(string, out long)
Tries the parse.
protected override bool TryParse(string value, out long result)
Parameters
Returns
- bool
Parse value to type
Tresult.