Mono Class Library: System.Decimal Overview | Members

System.Decimal Constructor

Constructs and initializes a new decimal value.

public Decimal (float value)

Parameters

value
The float value used to initialize the new decimal.

Exceptions

TypeReason
OverflowException

value is one of the following:

greater than decimal.MaxValue

less than decimal.MinValue

equal to float.NaN, but the Decimal representation does not support NaNs.

equal to float.PositiveInfinity, but the Decimal representation does not support infinities.

equal to float.NegativeInfinity, but the Decimal representation does not support infinities.

Remarks

This constructor initializes the new decimal to the value specified by value. This constructor rounds value to 7 significant digits using banker's rounding. The scale of the new decimal is the same as that produced by decimal.Parse(value.ToString()).

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0