UInt64.MinValue Field
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Represents the smallest possible value of UInt64. This field is constant.
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Syntax
'Declaration
Public Const MinValue As ULong
public const ulong MinValue
Remarks
The value of this constant is 0.
Examples
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. This prevents an OverflowException at run time.
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)
outputBlock.Text += String.Format("Converted {0} to {1}.", decimalValue, integerValue) + vbCrLf
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
outputBlock.Text += String.Format("Conversion failure: {0} is {1} than {2}", _
decimalInteger, _
relationship, _
rangeLimit) + vbCrLf
End If
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;
outputBlock.Text += String.Format("Converted {0} to {1}.", decimalValue, integerValue) + "\n";
}
else
{
ulong rangeLimit;
string relationship;
if (decimalInteger > ulong.MaxValue)
{
rangeLimit = ulong.MaxValue;
relationship = "greater";
}
else
{
rangeLimit = ulong.MinValue;
relationship = "less";
}
outputBlock.Text += String.Format("Conversion failure: {0} is {1} than {2}.",
decimalInteger,
relationship,
rangeLimit) + "\n";
}
Version Information
Silverlight
Supported in: 5, 4, 3
Silverlight for Windows Phone
Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0
XNA Framework
Supported in: Xbox 360, Windows Phone OS 7.0
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.