IntegerValidator クラスとは? わかりやすく解説

IntegerValidator クラス

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

Int32 の検証提供します

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

Public Class IntegerValidator
    Inherits ConfigurationValidatorBase
Dim instance As IntegerValidator
public class IntegerValidator : ConfigurationValidatorBase
public ref class IntegerValidator : public
 ConfigurationValidatorBase
public class IntegerValidator extends ConfigurationValidatorBase
public class IntegerValidator extends
 ConfigurationValidatorBase
解説解説
使用例使用例

IntegerValidator 型を使用する方法次のコード例示します

Imports System
Imports System.Configuration

Namespace Microsoft.Samples.AspNet.Validators
  Class UsingIntegerValidator
    Public Shared Sub Main()

      ' Display title.
      Console.WriteLine("ASP.NET Validators")
      Console.WriteLine()

      ' Create Integer and Validator.
      Dim testInt As Int32 = 5
      Dim minIntVal As Int32 = 1
      Dim maxIntVal As Int32 = 10
      Dim myIntegerValidator As IntegerValidator
 = _
        New IntegerValidator(minIntVal, maxIntVal, False)

      ' Determine if the object to validate can be validated.
      Console.WriteLine("CanValidate: {0}", _
        myIntegerValidator.CanValidate(testInt.GetType()))

      Try
        ' Attempt validation.
        myIntegerValidator.Validate(testInt)
        Console.WriteLine("Validated.")

      Catch e As Exception
        ' Validation failed.
        Console.WriteLine("Error: {0}", e.Message.ToString())
      End Try

      ' Display and wait.
      Console.ReadLine()
    End Sub
  End Class
End Namespace
using System;
using System.Configuration;

namespace Microsoft.Samples.AspNet.Validators
{
  class UsingIntergerValidator
  {
    static void Main(string[]
 args)
    {
      // Display title.
      Console.WriteLine("ASP.NET Validators");
      Console.WriteLine();

      // Create Integer and Validator.
      int testInt = 5;
      int minIntVal = 1;
      int maxIntVal = 10;
      IntegerValidator myIntegerValidator = 
    new IntegerValidator(minIntVal, maxIntVal, false);

      // Determine if the object to validate can be validated.
      Console.WriteLine("CanValidate: {0}",
        myIntegerValidator.CanValidate(testInt.GetType()));

      try
      {
        // Attempt validation.
        myIntegerValidator.Validate(testInt);
        Console.WriteLine("Validated.");
      }
      catch (ArgumentException e)
      {
        // Validation failed.
        Console.WriteLine("Error: {0}", e.Message.ToString());
      }

      // Display and wait
      Console.ReadLine();
    }
  }
}
継承階層継承階層
System.Object
   System.Configuration.ConfigurationValidatorBase
    System.Configuration.IntegerValidator
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
IntegerValidator メンバ
System.Configuration 名前空間
ConfigurationValidatorBase クラス



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「IntegerValidator クラス」の関連用語

IntegerValidator クラスのお隣キーワード
検索ランキング

   

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



IntegerValidator クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS