Class Rounder
A helper class for applying rounding in a consistent manner
Implements
Inherited Members
Namespace: LemonEdge.API.Core.FinancialServices.Processors
Assembly: LemonEdge.API.Core.FinancialServices.dll
Syntax
public class Rounder : IRounder
Constructors
Rounder(RoundingLevel, ICurrency)
Creates a new rounding class with the specified level and currency rounding
Declaration
public Rounder(RoundingLevel level, ICurrency currency)
Parameters
Type | Name | Description |
---|---|---|
RoundingLevel | level | The level to apply rounding at when using RoundToLevel(decimal) |
ICurrency | currency | The DecimalPlaces to use for rounding when using RoundToCurrency(decimal) |
Properties
Currency
The number of decimal places to round to (from DecimalPlaces) when using RoundToCurrency(decimal)
Declaration
public ICurrency Currency { get; set; }
Property Value
Type | Description |
---|---|
ICurrency |
Default
Declaration
public static RoundingLevel Default { get; }
Property Value
Type | Description |
---|---|
RoundingLevel |
DefaultRounding
The number of decimal places to round to when using RoundToDefault(decimal)
Declaration
public short DefaultRounding { get; set; }
Property Value
Type | Description |
---|---|
short |
Level
The rounding level to apply by default when using RoundToLevel(decimal)
Declaration
public RoundingLevel Level { get; set; }
Property Value
Type | Description |
---|---|
RoundingLevel |
Methods
RoundToCurrency(decimal)
Rounds the specified value to the number of decimal places associated with the Rounder.Currency.Currency
Declaration
public decimal RoundToCurrency(decimal value)
Parameters
Type | Name | Description |
---|---|---|
decimal | value | The value to be rounded |
Returns
Type | Description |
---|---|
decimal | The specified value rounded to the number of decimal places associated with the Rounder.Currency |
RoundToDefault(decimal)
Rounds the specified value to the number of decimal places associated with the Rounder.DefaultRounding
Declaration
public decimal RoundToDefault(decimal value)
Parameters
Type | Name | Description |
---|---|---|
decimal | value | The value to be rounded |
Returns
Type | Description |
---|---|
decimal | The specified value rounded to the number of decimal places associated with the Rounder.DefaultRounding |
RoundToLevel(decimal)
Rounds the specified value to the number of decimal places specified using Rounder.Level.Level
Declaration
public decimal RoundToLevel(decimal value)
Parameters
Type | Name | Description |
---|---|---|
decimal | value | The value to be rounded |
Returns
Type | Description |
---|---|
decimal | The specified value rounded to the number of decimal places specified using Rounder.Level |
RoundToLevel(decimal, RoundingLevel)
Rounds the specified value to the number of decimal places specified by the level
Declaration
public decimal RoundToLevel(decimal value, RoundingLevel level)
Parameters
Type | Name | Description |
---|---|---|
decimal | value | The value to be rounded |
RoundingLevel | level | The number of decimal places to round the value to |
Returns
Type | Description |
---|---|
decimal | The specified value rounded to the number of decimal places specified by the |