語言

IntegerValidator 建構函式

定義

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

多載

名稱 Description
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.cs
來源:
IntegerValidator.cs
來源:
IntegerValidator.cs
來源:
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.cs
來源:
IntegerValidator.cs
來源:
IntegerValidator.cs
來源:
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 不得介於 minValue 和 maxValue 參數值之間。

適用於

IntegerValidator(Int32, Int32, Boolean, Int32)

來源:
IntegerValidator.cs
來源:
IntegerValidator.cs
來源:
IntegerValidator.cs
來源:
IntegerValidator.cs
來源:
IntegerValidator.cs
來源:
IntegerValidator.cs
來源:
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值,才能通過驗證。

適用於