Class Rounder
A helper class for applying rounding in a consistent manner
Inheritance
Inherited Members
Namespace: LemonEdge.API.Processors
Assembly: API.dll
Syntax
public class Rounder
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 |
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 Currency
Declaration
public decimal RoundToCurrency(decimal value)
Parameters
Type | Name | Description |
---|---|---|
System.Decimal | value | The value to be rounded |
Returns
Type | Description |
---|---|
System.Decimal | The specified value rounded to the number of decimal places associated with the Currency |
RoundToLevel(Decimal)
Rounds the specified value to the number of decimal places specified using Level
Declaration
public decimal RoundToLevel(decimal value)
Parameters
Type | Name | Description |
---|---|---|
System.Decimal | value | The value to be rounded |
Returns
Type | Description |
---|---|
System.Decimal | The specified value rounded to the number of decimal places specified using 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 |
---|---|---|
System.Decimal | value | The value to be rounded |
RoundingLevel | level | The number of decimal places to round the value to |
Returns
Type | Description |
---|---|
System.Decimal | The specified value rounded to the number of decimal places specified by the |