C# Decimal ToDouble

Description

Decimal ToDouble converts the value of the specified Decimal to the equivalent double-precision floating-point number.

Syntax

Decimal.ToDouble has the following syntax.


public static double ToDouble(
  decimal d
)

Parameters

Decimal.ToDouble has the following parameters.

  • d - The decimal number to convert.

Returns

Decimal.ToDouble method returns A double-precision floating-point number equivalent to d.

Example

Example of decimal.ToDouble methods.


/* w  ww.jav a  2  s  . c om*/
using System;

class MainClass
{
    public static void Main( )
    {
        
        object DoubleValue;

        DoubleValue = decimal.ToDouble( 0.0000000000000000000000000001M );
        
        Console.WriteLine(DoubleValue);

    }
}

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