IntegerValidator Constructor (Int32, Int32, Boolean)


Initializes a new instance of the IntegerValidator class.

Namespace:   System.Configuration
Assembly:  System.Configuration (in System.Configuration.dll)

public IntegerValidator(
	int minValue,
	int maxValue,
	bool rangeIsExclusive


Type: System.Int32

An Int32 object that specifies the minimum value.

Type: System.Int32

An Int32 object that specifies the maximum value.

Type: System.Boolean

true to specify that the validation range is exclusive. Inclusive means the value to be validated must be within the specified range; exclusive means that it must be below the minimum or above the maximum.

When creating an instance of the IntegerValidator class, this IntegerValidator constructor checks both the minimum and maximum Int32 values, as well as whether the validation range is exclusive. When the rangeIsExclusive parameter is set to true, the Int32 value must not be between the minValue and maxValue parameter values.

The following code example demonstrates how to use the IntegerValidator constructor. This code example is part of a larger example provided for the IntegerValidator class.

// Create Validator for the range of 1 to 10 inclusive
int minIntVal = 1;
int maxIntVal = 10;
bool exclusive = false;
IntegerValidator integerValidator =
    new IntegerValidator(minIntVal, maxIntVal, exclusive);

.NET Framework
Available since 2.0
Return to top