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.

System..::..Object
  System.Globalization..::..NumberFormatInfo

Namespace:  System.Globalization
Assembly:  mscorlib (in mscorlib.dll)

[<Sealed>]
[<SerializableAttribute>]
type NumberFormatInfo =  class end

The NumberFormatInfo type exposes the following members.

  NameDescription
Public propertyStatic memberCurrentInfoGets a read-only NumberFormatInfo that formats values based on the current culture.
Public propertyNegativeSignGets or sets the string that denotes that the associated number is negative.
Public propertyNumberDecimalSeparatorGets or sets the string to use as the decimal separator in numeric values.
Public propertyNumberGroupSeparatorGets or sets the string that separates groups of digits to the left of the decimal in numeric values.
Public propertyNumberGroupSizesGets or sets the number of digits in each group to the left of the decimal in numeric values.
Public propertyPositiveSignGets or sets the string that denotes that the associated number is positive.
Top

  NameDescription
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

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.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show: