UInt64.MinValue Field


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Represents the smallest possible value of UInt64. This field is constant.

Namespace:   System
Assembly:  mscorlib (in mscorlib.dll)

public const ulong MinValue

Field Value

Type: System.UInt64

The value of this constant is 0.

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.

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);
   ulong rangeLimit;
   string relationship;

   if (decimalInteger > ulong.MaxValue)
      rangeLimit = ulong.MaxValue;
      relationship = "greater";
      rangeLimit = ulong.MinValue;
      relationship = "less";

   Console.WriteLine("Conversion failure: {0} is {1} than {2}.",  

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top