Click or drag to resize
CurrencyConverterConvert Method (Decimal, String, String, Int32)

Note: This API is now obsolete.

Converts given monetary amount expressed in one currency to another currency using site specific conversion.

Namespace: CMS.Ecommerce
Assembly: CMS.Ecommerce (in CMS.Ecommerce.dll) Version: 13.0.131
Syntax
C#
[ObsoleteAttribute("Use 'CMS.Core.Service.Resolve<ICurrencyConverterService>().Convert(System.Decimal, System.String, System.String, System.Int32)' instead.")]
public static decimal Convert(
	decimal amount,
	string inCurrencyCode,
	string toCurrencyCode,
	int siteID
)

Parameters

amount
Type: SystemDecimal
Amount to be converted.
inCurrencyCode
Type: SystemString
Code of the currency in which the amount is expressed (e.g. USD).
toCurrencyCode
Type: SystemString
Code of the currency to convert amount to (e.g. EUR).
siteID
Type: SystemInt32
ID of the site on which the conversion is done.

Return Value

Type: Decimal
Amount converted to target currency on specific site.
Exceptions
ExceptionCondition
ArgumentExceptionThrown when currency with given code does not exist in the system.
InvalidCurrencyConversionExceptionThrown when conversion fails (e.g. exchange rate not found).
See Also