Currency
Scripting with the Currency struct.
The Currency
struct is a representation of monetary value.
Fields & Properties
identity
The identity of the currency.
CurrencyIdentity
public
value
The currency value.
Currency.Value
public
stringValue
The value as a string.
string
public
Creating a Currency
To create a Currency
, you need a reference to a Currency Identity.
Managing Values
A Currency
uses the Value struct to support all numeric value types. The numeric type used by a Currency
depends on it's CurrencyIdentity
(int
, float
, or decimal
).
If you have strictCurrencyValueTypes
enabled in Settings, this will throw an error when trying to change the value using the incorrect numeric type.
Set the Value
To set a new value, you can use the SetValue
method.
Alternatively, you can use SetValueWithConversion
, which is similar to SetValue
, except it ignores the strictCurrencyValueTypes
settings field.
Operators
You can use operators to perform mathematical operations with currencies. Strict value types may apply.
Last updated