UInt64.MaxValue UInt64.MaxValue UInt64.MaxValue UInt64.MaxValue Field

정의

UInt64의 최대값을 나타냅니다.Represents the largest possible value of UInt64. 이 필드는 상수입니다.This field is constant.

public: System::UInt64 MaxValue = 18446744073709551615;
public const ulong MaxValue = 18446744073709551615;
val mutable MaxValue : uint64
Public Const MaxValue As ULong  = 18446744073709551615

필드 값

예제

다음 예제에서는 합니다 MinValueMaxValue 되었는지 확인 하는 필드를 Double 값이 범위 내에 UInt64 형식 변환을 수행 하기 전에 입력 합니다.The following example uses the MinValue and MaxValue fields to verify that a Double value is within the range of the UInt64 type before it performs a type conversion. 그러면는 OverflowException 런타임 시.This prevents an OverflowException at run time.

double decimalValue = -1.5;
ulong integerValue; 

// Discard fractional portion of Double value
double decimalInteger = Math.Floor(decimalValue);

if (decimalInteger <= ulong.MaxValue && 
    decimalInteger >= ulong.MinValue)
{    
   integerValue = (ulong) decimalValue;
   Console.WriteLine("Converted {0} to {1}.", decimalValue, integerValue);
}   
else
{
   ulong rangeLimit;
   string relationship;
   
   if (decimalInteger > ulong.MaxValue)
   {
      rangeLimit = ulong.MaxValue;
      relationship = "greater";
   }   
   else
   {
      rangeLimit = ulong.MinValue;
      relationship = "less";
   }       

   Console.WriteLine("Conversion failure: {0} is {1} than {2}.",  
                     decimalInteger, 
                     relationship, 
                     rangeLimit);
}       
Dim decimalValue As Double = -1.5
Dim integerValue As ULong 

' Discard fractional portion of Double value
Dim decimalInteger As Double = Math.Floor(decimalValue)

If decimalInteger <= ULong.MaxValue AndAlso _
   decimalInteger >= ULong.MinValue Then
   integerValue = CULng(decimalValue)
   Console.WriteLine("Converted {0} to {1}.", decimalValue, integerValue)
Else
   Dim rangeLimit As ULong
   Dim relationship As String
   
   If decimalInteger > ULong.MaxValue Then
      rangeLimit = ULong.MaxValue
      relationship = "greater"
   Else
      rangeLimit = ULong.MinValue
      relationship = "less"
   End If       

   Console.WriteLine("Conversion failure: {0} is {1} than {2}", _ 
                     decimalInteger, _
                     relationship, _
                     rangeLimit)
End If       

설명

이 상수의 값이 18446744073709551615; 즉, 16 진수 0xFFFFFFFFFFFFFFFF 합니다.The value of this constant is 18,446,744,073,709,551,615; that is, hexadecimal 0xFFFFFFFFFFFFFFFF.

적용 대상

추가 정보