Decimal Constructor (Double)

 

Initializes a new instance of Decimal to the value of the specified double-precision floating-point number.

Namespace:   System
Assembly:  mscorlib (in mscorlib.dll)

new : 
        value:float -> Decimal

Parameters

value
Type: System.Double

The value to represent as a Decimal.

Exception Condition
OverflowException

value is greater than MaxValue or less than MinValue.

-or-

value is Double.NaN, Double.PositiveInfinity, or Double.NegativeInfinity.

This constructor rounds value to 15 significant digits using rounding to nearest. This is done even if the number has more than 15 digits and the less significant digits are zero.

The following code example creates several Decimal numbers using the constructor overload that initializes a Decimal structure with a Double value.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
Show: