Currency Currency
Currency Currency
DocFX + Singulink = ♥

Search Results for

    Class RoundingPolicy

    Represents the rounding rules for monetary amounts of a currency, consisting of the number of decimal digits and an optional rounding increment expressed in units of the last decimal digit.

    Inheritance
    object
    RoundingPolicy
    Implements
    IEquatable<RoundingPolicy>
    Namespace: Singulink.Globalization
    Assembly: Singulink.Globalization.Currency.dll
    Syntax
    public sealed class RoundingPolicy : IEquatable<RoundingPolicy>
    Remarks

    A policy with 2 decimal digits and no rounding increment rounds amounts to the nearest 0.01. A policy with 2 decimal digits and a rounding increment of 5 rounds amounts to the nearest 0.05, which is how cash amounts are rounded for currencies such as the Canadian dollar and Swiss franc. A policy with 0 decimal digits rounds amounts to whole units.

    Constructors

    Name Description
    RoundingPolicy(int, int)

    Initializes a new instance of the RoundingPolicy class.

    Properties

    Name Description
    DecimalDigits

    Gets the number of decimal digits that amounts are rounded to.

    DecimalUnits

    Gets the rounding increment in units of the last decimal digit, where a unit is the smallest amount that can be represented with the number of DecimalDigits. A value of 0 indicates no additional rounding beyond the number of decimal digits.

    Default

    Gets the default rounding policy, which rounds amounts to 2 decimal digits with no additional rounding increment.

    SmallestUnitAmount

    Gets the smallest amount that is a valid multiple under this policy, based on DecimalDigits and DecimalUnits.

    Methods

    Name Description
    Equals(RoundingPolicy?)

    Determines whether the specified policy has the same decimal digits and decimal units as this policy.

    Equals(object?)

    Determines whether the specified object is equal to the current object.

    GetHashCode()

    Serves as the default hash function.

    RoundAmount(decimal, MidpointRounding)

    Returns the specified amount rounded according to this policy using the specified midpoint rounding mode, which defaults to ToEven ("banker's rounding") if not specified.

    ToString()

    Returns a string describing the smallest unit amount of this policy, i.e. "0.01" or "0.05".

    © Singulink. All rights reserved.