MoneyFormatOptions Class
Definition
Configures how a MoneyFormatter renders a monetary value. Translates to the format-specifier vocabulary understood by Money and Money<TCurrency>.
public sealed record MoneyFormatOptions : IEquatable<MoneyFormatOptions>
- Inheritance
-
MoneyFormatOptions
- Implements
- Inherited Members
- Extension Methods
Constructors
MoneyFormatOptions()
public MoneyFormatOptions()
Properties
CurrencyDisplay
Gets how the currency designator is rendered.
public CurrencyDisplay CurrencyDisplay { get; init; }
Property Value
- CurrencyDisplay
The configured CurrencyDisplay.
Default
Gets the shared default options: ISO-code designator, current-culture grouping, and the currency's natural minor-unit precision.
public static MoneyFormatOptions Default { get; }
Property Value
- MoneyFormatOptions
The default MoneyFormatOptions.
ElideWhenCultureMatches
Gets a value indicating whether the currency designator is elided when the formatting culture's region currency matches the amount's currency.
public bool ElideWhenCultureMatches { get; init; }
Property Value
FormatProvider
Gets the culture used to render the numeric component, or null for the current culture.
public IFormatProvider? FormatProvider { get; init; }
Property Value
- IFormatProvider
The configured format provider, or null.
IncludeGrouping
Gets a value indicating whether digit-group separators are emitted. Applies to the None presentation; currency presentations group according to the culture.
public bool IncludeGrouping { get; init; }
Property Value
MinorUnitsOverride
Gets an explicit fractional-digit count overriding the currency's natural precision, or null to use the currency's minor units.
public int? MinorUnitsOverride { get; init; }
Property Value
Methods
Equals(MoneyFormatOptions?)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(MoneyFormatOptions? other)
Parameters
otherMoneyFormatOptionsAn object to compare with this object.
Returns
Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current object.
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
Operators
operator ==(MoneyFormatOptions?, MoneyFormatOptions?)
public static bool operator ==(MoneyFormatOptions? left, MoneyFormatOptions? right)
Parameters
leftMoneyFormatOptionsrightMoneyFormatOptions
Returns
operator !=(MoneyFormatOptions?, MoneyFormatOptions?)
public static bool operator !=(MoneyFormatOptions? left, MoneyFormatOptions? right)
Parameters
leftMoneyFormatOptionsrightMoneyFormatOptions
Returns
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |