IntegerValidator 建構函式

定義

初始化 IntegerValidator 類別的新執行個體。

多載

IntegerValidator(Int32, Int32)

初始化 IntegerValidator 類別的新執行個體。

IntegerValidator(Int32, Int32, Boolean)

初始化 IntegerValidator 類別的新執行個體。

IntegerValidator(Int32, Int32, Boolean, Int32)

初始化 IntegerValidator 類別的新執行個體。

IntegerValidator(Int32, Int32)

來源:
IntegerValidator.cs
來源:
IntegerValidator.cs
來源:
IntegerValidator.cs

初始化 IntegerValidator 類別的新執行個體。

public:
 IntegerValidator(int minValue, int maxValue);
public IntegerValidator (int minValue, int maxValue);
new System.Configuration.IntegerValidator : int * int -> System.Configuration.IntegerValidator
Public Sub New (minValue As Integer, maxValue As Integer)

參數

minValue
Int32

Int32 物件,指定最小值。

maxValue
Int32

指定最小值的 Int32 物件。

備註

這個 IntegerValidator 建構函式可確保所驗證的整數同時遵守最小和最大長度。

適用於

IntegerValidator(Int32, Int32, Boolean)

來源:
IntegerValidator.cs
來源:
IntegerValidator.cs
來源:
IntegerValidator.cs

初始化 IntegerValidator 類別的新執行個體。

public:
 IntegerValidator(int minValue, int maxValue, bool rangeIsExclusive);
public IntegerValidator (int minValue, int maxValue, bool rangeIsExclusive);
new System.Configuration.IntegerValidator : int * int * bool -> System.Configuration.IntegerValidator
Public Sub New (minValue As Integer, maxValue As Integer, rangeIsExclusive As Boolean)

參數

minValue
Int32

Int32 物件,指定最小值。

maxValue
Int32

指定最小值的 Int32 物件。

rangeIsExclusive
Boolean

true 表示指定驗證範圍為排除。 「內含」表示要驗證的值必須在指定的範圍內;「排除」表示值必須低於最小值或高於最大值。

範例

下列程式代碼範例示範如何使用 建 IntegerValidator 構函式。 此程式代碼範例是針對 類別提供的較大範例的 IntegerValidator 一部分。

// 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);
' Create Validator for the range of 1 to 10 inclusive
Dim minIntVal As Int32 = 1
Dim maxIntVal As Int32 = 10
Dim exclusive As Boolean = False
Dim validator As IntegerValidator = _
    New IntegerValidator(minIntVal, maxIntVal, exclusive)

備註

建立 類別的 IntegerValidator 實例時,這個 IntegerValidator 建構函式會檢查最小值和最大值 Int32 ,以及驗證範圍是否為獨佔。 rangeIsExclusive當 參數設定為 true時,Int32值不得介於 和 maxValue 參數值之間minValue

適用於

IntegerValidator(Int32, Int32, Boolean, Int32)

來源:
IntegerValidator.cs
來源:
IntegerValidator.cs
來源:
IntegerValidator.cs

初始化 IntegerValidator 類別的新執行個體。

public:
 IntegerValidator(int minValue, int maxValue, bool rangeIsExclusive, int resolution);
public IntegerValidator (int minValue, int maxValue, bool rangeIsExclusive, int resolution);
new System.Configuration.IntegerValidator : int * int * bool * int -> System.Configuration.IntegerValidator
Public Sub New (minValue As Integer, maxValue As Integer, rangeIsExclusive As Boolean, resolution As Integer)

參數

minValue
Int32

Int32 物件,指定整數值的最小長度。

maxValue
Int32

Int32 物件,指定整數值的最大長度。

rangeIsExclusive
Boolean

Boolean 值,會指定驗證範圍是否為獨佔。

resolution
Int32

Int32 物件,其指定必須相符的值。

例外狀況

resolution 小於 0

-或-

minValue 大於 maxValue

備註

Int32 驗證的值必須等於 resolution 值,才能通過驗證。

適用於