Table of Contents

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

column string

The column.

value string

The value.

allowedThousands bool
customErrorMessageAccessor Func<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

column string

The column.

value string

The value.

min long?

The minimum.

max long?

The maximum.

allowedThousands bool

if set to true [allowed thousands].

customErrorMessageAccessor Func<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

true if [allowed thousands]; otherwise, false.

CastErrorMessageAccessor

Gets the cast error message accessor.

protected override Func<string, string, string> CastErrorMessageAccessor { get; }

Property Value

Func<string, string, string>

The cast error message accessor.

Methods

TryParse(string, out long)

Tries the parse.

protected override bool TryParse(string value, out long result)

Parameters

value string

The value.

result long

The result.

Returns

bool

Parse value to type T result.