C# Decimal Explicit(Double to Decimal)
Description
Decimal Explicit(Double to Decimal)
defines an explicit
conversion of a double-precision floating-point number to a Decimal.
Syntax
Decimal.Explicit(Double to Decimal)
has the following syntax.
public static explicit operator decimal (
double value
)
Parameters
Decimal.Explicit(Double to Decimal)
has the following parameters.
value
- The double-precision floating-point number to convert.
Returns
Decimal.Explicit(Double to Decimal)
method returns The converted double-precision floating point number.
Example
The following example converts Double values to Decimal numbers by using the Double to Decimal conversion.
/*from w w w .j a v a2 s . c om*/
using System;
class DecimalFromDoubleDemo
{
public static void Main( )
{
object decValue;
decValue = (decimal)1.23456789012345678E+12;
Console.WriteLine( decValue );
}
}
The code above generates the following result.