Try our conversational search powered by Generative AI!

Class CurrencyFormatter

Implements operations for the currecy formatter.

Inheritance
System.Object
CurrencyFormatter
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Mediachase.Commerce.Shared
Assembly: Mediachase.Commerce.dll
Version: 13.30.0
Syntax
public static class CurrencyFormatter

Properties

Cultures

Gets the cultures.

Declaration
public static CultureInfo[] Cultures { get; }
Property Value
Type Description
System.Globalization.CultureInfo[]

The cultures.

Methods

CanBeConverted(Currency, Currency)

Determines whether this instance [can be converted] the specified currency from.

Declaration
public static bool CanBeConverted(Currency currencyFrom, Currency currencyTo)
Parameters
Type Name Description
Currency currencyFrom

The currency from.

Currency currencyTo

The currency to.

Returns
Type Description
System.Boolean

true if this instance [can be converted] the specified currency from; otherwise, false.

CanBeConverted(Money, Currency)

Determines whether this instance [can be converted] the specified money from.

Declaration
public static bool CanBeConverted(Money moneyFrom, Currency currencyTo)
Parameters
Type Name Description
Money moneyFrom

The money from.

Currency currencyTo

The currency to.

Returns
Type Description
System.Boolean

true if this instance [can be converted] the specified money from; otherwise, false.

ConvertCurrency(Money, Currency)

Converts currency from moneyFrom to currencyTo. It will try to find the direct way to convert. If none is found it will try to find reverse way, if that is not available the base currency will be returned.

Declaration
public static Money ConvertCurrency(Money moneyFrom, Currency currencyTo)
Parameters
Type Name Description
Money moneyFrom

The amount and currency of money to be converted.

Currency currencyTo

The currency to convert the given money to.

Returns
Type Description
Money

The converted money.

Remarks

This function will actually return the effective currency code that was applied. The converted amount will be rounded with the currencyTo.

ConvertCurrencyWithFullPrecision(Money, Currency)

Converts currency from moneyFrom to currencyTo. It will try to find the direct way to convert. If none is found it will try to find reverse way, if that is not available the base currency will be returned.

Declaration
public static Money ConvertCurrencyWithFullPrecision(Money moneyFrom, Currency currencyTo)
Parameters
Type Name Description
Money moneyFrom

The amount and currency of money to be converted.

Currency currencyTo

The currency to convert the given money to.

Returns
Type Description
Money

The converted money.

Remarks

This function will actually return the effective currency code that was applied. The converted amount will be calculated with full precision.

CurrentCurrency()

Return the three letter ISO currency code for the current thread.

Declaration
public static Currency CurrentCurrency()
Returns
Type Description
Currency

current currency code in String