UInt64.MaxValue 필드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
UInt64의 가능한 최대값을 나타냅니다. 이 필드는 상수입니다.
public: System::UInt64 MaxValue = 18446744073709551615;
public const ulong MaxValue = 18446744073709551615;
val mutable MaxValue : uint64
Public Const MaxValue As ULong = 18446744073709551615
필드 값
Value = 18446744073709551615예제
다음 예제에서는 및 필드를 사용 하 여 MinValue MaxValue Double UInt64 형식 변환을 수행 하기 전에 형식의 범위 내에 값이 있는지 확인 합니다. 이렇게 하면 런타임에가 방지 OverflowException 됩니다.
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입니다.