IntegerValidatorAttributeとは? わかりやすく解説

IntegerValidatorAttribute クラス

メモ : このクラスは、.NET Framework version 2.0 で新しく追加されたものです。

.NET Framework が構成プロパティに対して整数の検証を実行するように、宣言によって指示します。このクラスは継承できません。

名前空間: System.Configuration
アセンブリ: System.Configuration (system.configuration.dll 内)
構文構文

<AttributeUsageAttribute(AttributeTargets.Property)> _
Public NotInheritable Class
 IntegerValidatorAttribute
    Inherits ConfigurationValidatorAttribute
Dim instance As IntegerValidatorAttribute
[AttributeUsageAttribute(AttributeTargets.Property)] 
public sealed class IntegerValidatorAttribute
 : ConfigurationValidatorAttribute
[AttributeUsageAttribute(AttributeTargets::Property)] 
public ref class IntegerValidatorAttribute
 sealed : public ConfigurationValidatorAttribute
/** @attribute AttributeUsageAttribute(AttributeTargets.Property) */ 
public final class IntegerValidatorAttribute
 extends ConfigurationValidatorAttribute
AttributeUsageAttribute(AttributeTargets.Property) 
public final class IntegerValidatorAttribute
 extends ConfigurationValidatorAttribute
解説解説

IntegerValidatorAttribute を使用して、.NET Framework が IntegerValidator オブジェクトを使用してプロパティを検証するように指示する構成プロパティを装飾し、装飾のパラメータの値を渡します。

IntegerValidatorAttribute オブジェクトは、プロパティ型だけに適用できます。

使用例使用例

IntegerValidatorAttribute オブジェクトを使用して、カスタム ConfigurationSection オブジェクトのプロパティを装飾する方法を、次のコード例に示します。

<ConfigurationProperty("maxAttempts", _
DefaultValue:=101, _
IsRequired:=True), _
IntegerValidator(MinValue:=1, _
MaxValue:=100, _
ExcludeRange:=True)> _
Public Property MaxAttempts() As
 Integer
    Get
        Return Fix(Me("maxAttempts"))
    End Get
    Set(ByVal value As Integer)
        Me("maxAttempts") = value
    End Set
End Property
[ConfigurationProperty("maxAttempts", DefaultValue = 101,
    IsRequired = true)]
[IntegerValidator(MinValue = 1, MaxValue = 100,
    ExcludeRange = true)]
public int MaxAttempts
{
    get
    {
        return (int)this["maxAttempts"];
    }
    set
    {
        this["maxAttempts"] = value;
    }
}
継承階層継承階層
System.Object
   System.Attribute
     System.Configuration.ConfigurationValidatorAttribute
      System.Configuration.IntegerValidatorAttribute
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
IntegerValidatorAttribute メンバ
System.Configuration 名前空間
ConfigurationValidatorAttribute クラス
ConfigurationSection クラス
ConfigurationPropertyAttribute クラス
IntegerValidator クラス

IntegerValidatorAttribute コンストラクタ

メモ : このコンストラクタは、.NET Framework version 2.0 で新しく追加されたものです。

IntegerValidatorAttribute クラスの新しいインスタンスを作成します。

名前空間: System.Configuration
アセンブリ: System.Configuration (system.configuration.dll 内)
構文構文

Dim instance As New IntegerValidatorAttribute
public IntegerValidatorAttribute ()
public:
IntegerValidatorAttribute ()
public IntegerValidatorAttribute ()
public function IntegerValidatorAttribute ()
解説解説
使用例使用例

IntegerValidatorAttribute コンストラクタを使用する例を次に示します。

<ConfigurationProperty("maxSize", _
DefaultValue:=1000, _
IsRequired:=True), _
IntegerValidator()> _
Public Property MaxSize() As
 Integer
    Get
        Return Fix(Me("maxSize"))
    End Get
    Set(ByVal value As Integer)
        Me("maxSize") = value
    End Set
End Property
[ConfigurationProperty("maxSize", DefaultValue = 1000,
    IsRequired = true)]
[IntegerValidator()]
public int MaxSize
{
    get
    {
        return (int)this["maxSize"];
    }
    set
    {
        this["maxSize"] = value;
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
IntegerValidatorAttribute クラス
IntegerValidatorAttribute メンバ
System.Configuration 名前空間

IntegerValidatorAttribute プロパティ


パブリック プロパティパブリック プロパティ

  名前 説明
パブリック プロパティ ExcludeRange 整数を、MinValue プロパティ値と MaxValue プロパティ値によって定義された範囲内に含めるか、その範囲から除外するかを示す値を取得または設定します。
パブリック プロパティ MaxValue プロパティに指定できる最大値を取得または設定します。
パブリック プロパティ MinValue プロパティに指定できる最小値を取得または設定します。
パブリック プロパティ TypeId  派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。 ( Attribute から継承されます。)
パブリック プロパティ ValidatorInstance オーバーライドされます。 IntegerValidator クラスのインスタンスを取得します。
パブリック プロパティ ValidatorType  検証コントロールの属性の型を取得します。 ( ConfigurationValidatorAttribute から継承されます。)
参照参照

関連項目

IntegerValidatorAttribute クラス
System.Configuration 名前空間
ConfigurationValidatorAttribute クラス
ConfigurationSection クラス
ConfigurationPropertyAttribute クラス
IntegerValidator クラス

IntegerValidatorAttribute メソッド


パブリック メソッドパブリック メソッド

( プロテクト メソッド も参照)
  名前 説明
パブリック メソッド Equals  オーバーロードされます。 ( Attribute から継承されます。)
パブリック メソッド GetCustomAttribute  オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 ( Attribute から継承されます。)
パブリック メソッド GetCustomAttributes  オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 ( Attribute から継承されます。)
パブリック メソッド GetHashCode  このインスタンスのハッシュ コードを返します。 ( Attribute から継承されます。)
パブリック メソッド GetType  現在のインスタンスの Type を取得します。 ( Object から継承されます。)
パブリック メソッド IsDefaultAttribute  派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 ( Attribute から継承されます。)
パブリック メソッド IsDefined  オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 ( Attribute から継承されます。)
パブリック メソッド Match  派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 ( Attribute から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。)
パブリック メソッド ToString  現在の Object を表す String を返します。 ( Object から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

IntegerValidatorAttribute クラス
System.Configuration 名前空間
ConfigurationValidatorAttribute クラス
ConfigurationSection クラス
ConfigurationPropertyAttribute クラス
IntegerValidator クラス

IntegerValidatorAttribute メンバ

.NET Framework が構成プロパティに対して整数の検証を実行するように、宣言によって指示します。このクラスは継承できません。

IntegerValidatorAttribute データ型で公開されるメンバを以下の表に示します。


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド IntegerValidatorAttribute IntegerValidatorAttribute クラスの新しいインスタンスを作成します。
パブリック プロパティパブリック プロパティ
  名前 説明
パブリック プロパティ ExcludeRange 整数を、MinValue プロパティ値と MaxValue プロパティ値によって定義された範囲内に含めるか、その範囲から除外するかを示す値を取得または設定します。
パブリック プロパティ MaxValue プロパティに指定できる最大値を取得または設定します。
パブリック プロパティ MinValue プロパティに指定できる最小値を取得または設定します。
パブリック プロパティ TypeId  派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。(Attribute から継承されます。)
パブリック プロパティ ValidatorInstance オーバーライドされます。 IntegerValidator クラスのインスタンスを取得します。
パブリック プロパティ ValidatorType  検証コントロールの属性の型を取得します。(ConfigurationValidatorAttribute から継承されます。)
パブリック メソッドパブリック メソッド
( プロテクト メソッド も参照)
  名前 説明
パブリック メソッド Equals  オーバーロードされます。 ( Attribute から継承されます。)
パブリック メソッド GetCustomAttribute  オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 (Attribute から継承されます。)
パブリック メソッド GetCustomAttributes  オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 (Attribute から継承されます。)
パブリック メソッド GetHashCode  このインスタンスのハッシュ コードを返します。 (Attribute から継承されます。)
パブリック メソッド GetType  現在のインスタンスの Type を取得します。 (Object から継承されます。)
パブリック メソッド IsDefaultAttribute  派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 (Attribute から継承されます。)
パブリック メソッド IsDefined  オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 (Attribute から継承されます。)
パブリック メソッド Match  派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 (Attribute から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。)
パブリック メソッド ToString  現在の Object を表す String を返します。 (Object から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

IntegerValidatorAttribute クラス
System.Configuration 名前空間
ConfigurationValidatorAttribute クラス
ConfigurationSection クラス
ConfigurationPropertyAttribute クラス
IntegerValidator クラス



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

「IntegerValidatorAttribute」の関連用語

IntegerValidatorAttributeのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



IntegerValidatorAttributeのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS