C# Decimal Explicit(Single to Decimal)
Description
Decimal Explicit(Single to Decimal)
defines an explicit
conversion of a single-precision floating-point number to a Decimal.
Syntax
Decimal.Explicit(Single to Decimal)
has the following syntax.
public static explicit operator decimal (
float value
)
Parameters
Decimal.Explicit(Single to Decimal)
has the following parameters.
value
- The single-precision floating-point number to convert.
Returns
Decimal.Explicit(Single to Decimal)
method returns The converted single-precision floating point number.
Example
The following example converts Single values to Decimal numbers by using the Single to Decimal conversion.
using System;//from w w w . ja v a 2 s.c o m
class DecimalFromSingleDemo
{
public static void Main( )
{
object decValue;
decValue = (decimal)1.2345E-30F;
Console.WriteLine( decValue );
}
}
The code above generates the following result.