MidpointRoundingStrategy Class
Definition
- Assembly
- Bodu.Financial.dll
- Package
- Bodu.Financial 1.0.0
An IRoundingStrategy backed by a MidpointRounding mode, rounding via Round(decimal, int, MidpointRounding).
public sealed class MidpointRoundingStrategy : IRoundingStrategy
- Inheritance
-
MidpointRoundingStrategy
- Implements
- Inherited Members
- Extension Methods
Constructors
MidpointRoundingStrategy(MidpointRounding)
Initializes a new instance of the MidpointRoundingStrategy class.
public MidpointRoundingStrategy(MidpointRounding mode)
Parameters
modeMidpointRoundingThe midpoint-rounding mode to apply.
Fields
AwayFromZero
The shared away-from-zero (AwayFromZero) strategy.
public static readonly MidpointRoundingStrategy AwayFromZero
Field Value
ToEven
The shared banker's-rounding (ToEven) strategy.
public static readonly MidpointRoundingStrategy ToEven
Field Value
Properties
Mode
Gets the midpoint-rounding mode applied by this strategy.
public MidpointRounding Mode { get; }
Property Value
- MidpointRounding
The configured MidpointRounding mode.
Methods
Round(decimal, int)
Rounds value to scale fractional digits.
public decimal Round(decimal value, int scale)
Parameters
Returns
- decimal
The rounded amount.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |