Skip to content

Currency

Namespace Mc.Scripting.Services · Kind class (sealed)

public sealed class Currency : IEquatable<Currency>

A currency. Amounts are long minor units (cents when Currency.FractionDigits is 2): no floating point on any path.

Member Description
Currency(string Name, string Symbol, int FractionDigits, string PluralName) A currency.
public Currency(string Name, string Symbol, int FractionDigits, string PluralName)

A currency. Amounts are long minor units (cents when Currency.FractionDigits is 2): no floating point on any path.

Parameters

Name Type Description
Name string The name (“dollar”).
Symbol string The symbol written before the amount (“$”).
FractionDigits int Minor units per major unit as a power of ten (2 = cents), 0 to 9.
PluralName string The plural name (“dollars”).
Member Description
int FractionDigits { get; init; } Minor units per major unit as a power of ten, 0 to 9 (checked when the currency is made).
string Name { get; init; } The name (“dollar”).
string PluralName { get; init; } The plural name (“dollars”).
string Symbol { get; init; } The symbol written before the amount (“$”).
public int FractionDigits { get; init; }

Minor units per major unit as a power of ten, 0 to 9 (checked when the currency is made).

Throws

  • System.ArgumentOutOfRangeException: The digits are outside 0 to 9.
public string Name { get; init; }

The name (“dollar”).

public string PluralName { get; init; }

The plural name (“dollars”).

public string Symbol { get; init; }

The symbol written before the amount (“$”).

Member Description
string Format(long minor) The amount as text: the symbol, the major units and the minor units after a point (“$12.05”).
public string Format(long minor)

The amount as text: the symbol, the major units and the minor units after a point (“$12.05”). Negative amounts start with a minus sign.

Parameters

Name Type Description
minor long The amount in minor units.

Returns string: The text.