NumberFormatInfo Class
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Defines how numeric values are formatted and displayed, depending on the culture.
Inheritance Hierarchy
System. . :: . .Object
System.Globalization..::..NumberFormatInfo
Namespace: System.Globalization
Assembly: mscorlib (in mscorlib.dll)
Syntax
'Declaration
<SerializableAttribute> _
Public NotInheritable Class NumberFormatInfo
[SerializableAttribute]
public sealed class NumberFormatInfo
[SerializableAttribute]
public ref class NumberFormatInfo sealed
[<Sealed>]
[<SerializableAttribute>]
type NumberFormatInfo = class end
public final class NumberFormatInfo
The NumberFormatInfo type exposes the following members.
Properties
Name | Description | |
---|---|---|
CurrentInfo | Gets a read-only NumberFormatInfo that formats values based on the current culture. | |
NegativeSign | Gets or sets the string that denotes that the associated number is negative. | |
NumberDecimalSeparator | Gets or sets the string to use as the decimal separator in numeric values. | |
NumberGroupSeparator | Gets or sets the string that separates groups of digits to the left of the decimal in numeric values. | |
NumberGroupSizes | Gets or sets the number of digits in each group to the left of the decimal in numeric values. | |
PositiveSign | Gets or sets the string that denotes that the associated number is positive. |
Top
Methods
Name | Description | |
---|---|---|
Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Top
Remarks
This class contains information, such as currency, decimal separators, and other numeric symbols.
Numeric values are formatted using standard or custom patterns stored in the properties of a NumberFormatInfo. To modify the display of a value, the application must make the NumberFormatInfo object writable so that custom patterns can be saved in its properties.
The following table describes the format patterns for each standard format specifier and the associated NumberFormatInfo properties that can be set to modify the standard formats. For details about the use of these patterns, see Standard Numeric Format Strings.
Format pattern |
Description and associated properties |
---|---|
c, C |
Currency format. Associated properties: CurrencyDecimalDigits, CurrencyDecimalSeparator, CurrencyGroupSeparator, CurrencyGroupSizes, CurrencyNegativePattern, CurrencyPositivePattern, CurrencySymbol, NegativeSign |
d, D |
Decimal format. Associated properties: NegativeSign |
e, E |
Scientific (exponential) format. Associated properties: NegativeSign, NumberDecimalSeparator, PositiveSign |
f, F |
Fixed-point format. Associated properties: NegativeSign, NumberDecimalDigits, NumberDecimalSeparator |
g, G |
General format. Associated properties: NegativeSign, NumberDecimalDigits, NumberDecimalSeparator, PositiveSign |
n, N |
Number format. Associated properties: NegativeSign, NumberDecimalDigits, NumberDecimalSeparator, NumberGroupSeparator, NumberGroupSizes, NumberNegativePattern |
p, P |
Percent format. Associated properties: NegativeSign, PercentDecimalDigits, PercentDecimalSeparator, PercentGroupSeparator, PercentGroupSizes, PercentNegativePattern, PercentPositivePattern, PercentSymbol |
r, R |
Round-trip format. Associated properties: NegativeSign, NumberDecimalSeparator, PositiveSign |
x, X |
Hexadecimal format. |
A NumberFormatInfo object can be created only for the invariant culture or for specific cultures, not for neutral cultures. For more information about the invariant culture, specific cultures, and neutral cultures, see the CultureInfo class.
NumberFormatInfo implements the ICloneable interface to enable duplication of NumberFormatInfo objects. It also implements IFormatProvider to supply formatting information to applications.
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.