Search Results for

    Show / Hide Table of Contents

    Class Rounder

    A helper class for applying rounding in a consistent manner

    Inheritance
    object
    Rounder
    Implements
    IRounder
    Inherited Members
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    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 level

    Implements

    IRounder

    Extension Methods

    LinqExtensions.AsArray<T>(T)
    LinqExtensions.ToArrayOfOne<T>(T)
    LinqExtensions.ToListOfOne<T>(T)
    MiscExtensions.SetIfNotEqual<T, TP>(T, Expression<Func<T, TP>>, TP)
    WeakReferenceExtensions.WeakReference(object)
    SQLExtensions.ToSQLValue(object, bool)
    ReflectionExtensions.ClearEventInvocations(object, string)
    StringExtensions.ToCSVFormatString(object, Type)
    In this article
    Back to top © LemonEdge Technologies. All rights reserved.