C# Decimal Explicit(Decimal to Double)

Description

Decimal Explicit(Decimal to Double) defines an explicit conversion of a Decimal to a double-precision floating-point number.

Syntax

Decimal.Explicit(Decimal to Double) has the following syntax.


public static explicit operator double (
  decimal value
)

Parameters

Decimal.Explicit(Decimal to Double) has the following parameters.

  • value - The value to convert.

Returns

Decimal.Explicit(Decimal to Double) method returns A double-precision floating-point number that represents the converted Decimal.

Example

The following example converts Decimal numbers to Double values by using the explicit Decimal to Double conversion.


using System;//from w  w  w.j  a  v  a2 s.c om

class Example
{
    public static void Main( )
    {
        // Convert each value to a double. 
        double dblValue = (double) 0.0000000000123456789123456789M;
        Console.WriteLine(dblValue);
    }
}

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