Struct Cash
Currency-tagged fixed-point quantity. Amount carries its own precision (N) so two Cash values representing the same monetary amount at different precisions are not equal.
public struct Cash
- Inherited Members
Examples
var price = new Cash(Currency.CurrencySymbol.USD, new DecimalAmount(99, 95, 2));
Console.WriteLine(price); // "USD 99.95"
Constructors
Cash(CurrencySymbol, DecimalAmount)
Construct a cash amount.
public Cash(Currency.CurrencySymbol currency, DecimalAmount amount)
Parameters
currencyCurrency.CurrencySymbolCurrency of the amount.
amountDecimalAmountNumeric amount.
Properties
Amount
The numeric amount. Precision is per-instance via N.
public DecimalAmount Amount { readonly get; set; }
Property Value
Currency
The currency of the cash amount.
public Currency.CurrencySymbol Currency { readonly get; set; }
Property Value
Zero
A zero cash amount in USD.
public static Cash Zero { get; }
Property Value
Methods
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.