LongValidator 클래스

정의

Int64 값의 유효성을 검사합니다.

public ref class LongValidator : System::Configuration::ConfigurationValidatorBase
public class LongValidator : System.Configuration.ConfigurationValidatorBase
type LongValidator = class
    inherit ConfigurationValidatorBase
Public Class LongValidator
Inherits ConfigurationValidatorBase
상속

예제

다음 코드 예제를 사용 하는 방법에 설명 합니다 LongValidator 형식입니다.

using System;
using System.Configuration;

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

      // Create Long and Validator.
      Int64 testLong =    17592186044416;
      Int64 minLongVal =  1099511627776;
      Int64 maxLongVal =  281474976710656;
      LongValidator myLongValidator = 
       new LongValidator(minLongVal, maxLongVal, false);

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

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

      // Display and wait
      Console.ReadLine();
    }
  }
}
Imports System.Configuration

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

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

      ' Create Long and Validator.
      Dim testLong As Int64 = 17592186044416
      Dim minLongVal As Int64 = 1099511627776
      Dim maxLongVal As Int64 = 281474976710656
      Dim myLongValidator As LongValidator = _
       New LongValidator(minLongVal, maxLongVal, False)

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

      Try
        ' Attempt validation.
        myLongValidator.Validate(testLong)
        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

설명

LongValidator (64비트 부호 있는 정수)가 특정 조건을 충족하는지 확인하는 long 데 사용됩니다. 유효성 검사 기준은 클래스의 LongValidator instance 만들 때 설정됩니다. LongValidator(Int64, Int64) 생성자는 유효성을 검사하는 값이 최소 길이와 최대 길이를 모두 준수하는지 확인 long 합니다. LongValidator(Int64, Int64, Boolean) 생성자는 최소값과 최대 Int64 값 및 유효성 검사 범위가 배타적인지 여부를 모두 확인합니다. LongValidator(Int64, Int64, Boolean, Int64) 생성자는 이전 세 개의 매개 변수를 확인하고 값이 Int64 특정 해상도 값과 같은지 여부도 확인합니다.

CanValidate 메서드 유효성을 검사할 개체 형식에 필요한 형식과 일치 하는지 여부를 결정 합니다. 유효성 검사 중인 개체의 매개 변수로 전달 되는 Validate 메서드.

생성자

LongValidator(Int64, Int64)

LongValidator 클래스의 새 인스턴스를 초기화합니다.

LongValidator(Int64, Int64, Boolean)

LongValidator 클래스의 새 인스턴스를 초기화합니다.

LongValidator(Int64, Int64, Boolean, Int64)

LongValidator 클래스의 새 인스턴스를 초기화합니다.

메서드

CanValidate(Type)

개체 형식의 유효성을 검사할 수 있는지 여부를 확인합니다.

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)
Validate(Object)

개체의 값이 유효한지 여부를 확인합니다.

적용 대상

추가 정보