Decimal Constructor (Single)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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

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

new : 
        value:float32 -> Decimal

Parameters

value
Type: System.Single

The value to represent as a Decimal.

Exception Condition
OverflowException

value is greater than MaxValue or less than MinValue.

-or-

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

This constructor rounds value to 7 significant digits using rounding to nearest. This is done even if the number has more than 7 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 Single 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: