C# Decimal ToUInt64

Description

Decimal ToUInt64 converts the value of the specified Decimal to the equivalent 64-bit unsigned integer.

Syntax

Decimal.ToUInt64 has the following syntax.


[CLSCompliantAttribute(false)]
public static ulong ToUInt64(
  decimal d
)

Parameters

Decimal.ToUInt64 has the following parameters.

  • d - The decimal number to convert.

Returns

Decimal.ToUInt64 method returns A 64-bit unsigned integer equivalent to the value of d.

Example

The following example uses the ToUInt64 method to convert decimal numbers to UInt64 values.


//from  www  .j  av a 2 s.  c  o  m
using System;

class Example
{
   public static void Main( )
   {
       ulong number = Decimal.ToUInt64(123.999m);
       Console.WriteLine(number);       
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version