MoneyFormatter Class
Definition
Renders Money and Money<TCurrency> values according to a fixed MoneyFormatOptions, translating the options into the format-specifier vocabulary of the monetary types.
public sealed class MoneyFormatter
- Inheritance
-
MoneyFormatter
- Inherited Members
- Extension Methods
Constructors
MoneyFormatter(MoneyFormatOptions)
Initializes a new instance of the MoneyFormatter class.
public MoneyFormatter(MoneyFormatOptions options)
Parameters
optionsMoneyFormatOptionsThe formatting options.
Exceptions
- ArgumentNullException
optionsis null.- ArgumentOutOfRangeException
options.CurrencyDisplay is not a defined value.
Methods
Format(Money)
Formats a runtime-tagged Money value.
public string Format(Money money)
Parameters
moneyMoneyThe value to format.
Returns
- string
The formatted string.
Format<TCurrency>(Money<TCurrency>)
Formats a strongly-typed Money<TCurrency> value.
public string Format<TCurrency>(Money<TCurrency> money) where TCurrency : ICurrency
Parameters
moneyMoney<TCurrency>The value to format.
Returns
- string
The formatted string.
Type Parameters
TCurrencyThe currency type.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |