asp.net.ph

NumberFormatInfo Class

System.Globalization Namespace


Defines how numeric values are formatted and displayed, depending on the culture.

NumberFormatInfo Class Members

Collapse   Constructors

Visibility Constructor Parameters
public NumberFormatInfo ( )

Collapse   Properties

Visibility Name Value Type Accessibility
public CurrencyDecimalDigits Int32 [ Get , Set ]
public CurrencyDecimalSeparator String [ Get , Set ]
public CurrencyGroupSeparator String [ Get , Set ]
public CurrencyGroupSizes Int32 [ Get , Set ]
public CurrencyNegativePattern Int32 [ Get , Set ]
public CurrencyPositivePattern Int32 [ Get , Set ]
public CurrencySymbol String [ Get , Set ]
public static CurrentInfo NumberFormatInfo [ Get ]
public DigitSubstitution DigitShapes [ Get , Set ]
public static InvariantInfo NumberFormatInfo [ Get ]
public IsReadOnly Boolean [ Get ]
public NaNSymbol String [ Get , Set ]
public NativeDigits String [ Get , Set ]
public NegativeInfinitySymbol String [ Get , Set ]
public NegativeSign String [ Get , Set ]
public NumberDecimalDigits Int32 [ Get , Set ]
public NumberDecimalSeparator String [ Get , Set ]
public NumberGroupSeparator String [ Get , Set ]
public NumberGroupSizes Int32 [ Get , Set ]
public NumberNegativePattern Int32 [ Get , Set ]
public PercentDecimalDigits Int32 [ Get , Set ]
public PercentDecimalSeparator String [ Get , Set ]
public PercentGroupSeparator String [ Get , Set ]
public PercentGroupSizes Int32 [ Get , Set ]
public PercentNegativePattern Int32 [ Get , Set ]
public PercentPositivePattern Int32 [ Get , Set ]
public PercentSymbol String [ Get , Set ]
public PerMilleSymbol String [ Get , Set ]
public PositiveInfinitySymbol String [ Get , Set ]
public PositiveSign String [ Get , Set ]

Collapse   Methods

Visibility Name Parameters Return Type
public Clone ( ) Object
public GetFormat ( Type formatType ) Object
public static GetInstance ( IFormatProvider formatProvider ) NumberFormatInfo
public static ReadOnly ( NumberFormatInfo nfi ) NumberFormatInfo

Remarks

This class contains information, such as currency, decimal separators, and other numeric symbols.

To create a NumberFormatInfo for a specific culture, create a CultureInfo for that culture and retrieve the CultureInfo.NumberFormat property. To create a NumberFormatInfo for the culture of the current thread, use the CurrentInfo property. To create a NumberFormatInfo for the invariant culture, use the InvariantInfo property for a read-only version, or use the NumberFormatInfo constructor for a writable version. It is not possible to create a NumberFormatInfo for a neutral culture.

The user might choose to override some of the values associated with the current culture of Windows through Regional and Language Options ( or Regional Options or Regional Settings ) in Control Panel. For example, the user might choose to display the date in a different format or to use a currency other than the default for the culture. If the CultureInfo.UseUserOverride property is set to true, the properties of the CultureInfo.DateTimeFormat instance, the CultureInfo.NumberFormat instance, and the CultureInfo.TextInfo instance are also retrieved from the user settings. If the user settings are incompatible with the culture associated with the CultureInfo ( for example, if the selected calendar is not one of the OptionalCalendars ), the results of the methods and the values of the properties are undefined.

Numeric values are formatted using standard or custom patterns stored in the properties of a NumberFormatInfo. To modify how a value is displayed, the NumberFormatInfo must be writable so custom patterns can be saved in its properties.

The following table lists the standard format characters for each standard pattern and the associated NumberFormatInfo property that can be set to modify the standard pattern.

Format Character Description and Associated Properties
c, C Currency format. CurrencyNegativePattern, CurrencyPositivePattern, CurrencySymbol, CurrencyGroupSizes, CurrencyGroupSeparator, CurrencyDecimalDigits, CurrencyDecimalSeparator.
d, D Decimal format.
e, E Scientific ( exponential ) format.
f, F Fixed-point format.
g, G General format.
n, N Number format. NumberNegativePattern, NumberGroupSizes, NumberGroupSeparator, NumberDecimalDigits, NumberDecimalSeparator.
r, R Roundtrip format, which ensures that numbers converted to strings will have the same value when they are converted back to numbers.
x, X Hexadecimal format.

A DateTimeFormatInfo or a NumberFormatInfo 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.

This class implements the ICloneable interface to enable duplication of NumberFormatInfo objects. It also implements IFormatProvider to supply formatting information to applications.

See Also

Decimal   CultureInfo Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph