IntegerValidatorAttribute
Declaratively instructs the .NET Framework to perform integer validation on a configuration property. This class cannot be inherited.
namespace System.Configuration
{
[AttributeUsage(AttributeTargets.Property)]
public sealed class IntegerValidatorAttribute : ConfigurationValidatorAttribute
{
private int _max = 2147483647;
private int _min = -2147483648;
public override ConfigurationValidatorBase ValidatorInstance => new IntegerValidator(_min, _max, ExcludeRange);
public int MinValue {
get {
return _min;
}
set {
if (_max < value)
throw new ArgumentOutOfRangeException("value", System.SR.Validator_min_greater_than_max);
_min = value;
}
}
public int MaxValue {
get {
return _max;
}
set {
if (_min > value)
throw new ArgumentOutOfRangeException("value", System.SR.Validator_min_greater_than_max);
_max = value;
}
}
public bool ExcludeRange { get; set; }
}
}