BCL mscorlib [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ] 1.0.5000.0 2.0.0.0 4.0.0.0 This type is safe for multithreaded operations. System.Object System.ICloneable System.IFormatProvider System.Runtime.InteropServices.ComVisible(true)

The class contains culture-specific information that is used when you format and parse numeric values. This information includes the currency symbol, the decimal symbol, the group separator symbol, and the symbols for positive and negative signs.

Instantiating a NumberFormatInfo object

For the current culture

For the invariant culture

For a specific culture

For a neutral culture

NumberFormatInfo and dynamic data

IFormatProvider, NumberFormatInfo, and numeric formatting

Format strings and NumberFormatInfo properties

Modifying NumberFormatInfo properties

Modifying the currency symbol and pattern

Formatting a national identification number

Parsing numeric strings

Parsing user strings

Serializing and deserializing numeric data

## Instantiating a NumberFormatInfo object

You can instantiate a object that represents the formatting conventions of the current culture, the invariant culture, a specific culture, or a neutral culture.

## Instantiating a NumberFormatInfo object for the current culture

You can instantiate a object for the current thread culture in any of the following ways. In each case, the returned object is read-only.

By retrieving a object that represents the current thread culture from the property, and retrieving the object from its property.

By retrieving the object returned by the static (Shared in Visual Basic) property.

By calling the method with a object that represents the current culture.

The following example uses these three ways to create objects that represent the formatting conventions of the current culture. It also retrieves the value of the property to illustrate that each object is read-only.

code reference: System.Globalization.NumberFormatInfo.Class.Instantiate#1

You can create a writable object that represents the conventions of the current thread culture in any of the following ways:

By retrieving a object in any of the ways illustrated in the previous code example, and calling the method on the returned object. This creates a copy of the original object, except that its property is false.

By calling the method to create a object that represents the current culture, and then using its property to retrieve the object.

The following example illustrates these two ways of instantiating a object, and displays the value of its property to illustrate that the object is not read-only.

code reference: System.Globalization.NumberFormatInfo.Class.Instantiate#2

Note that the Windows operating system allows the user to override some of the property values used in numeric formatting and parsing operations through the Region and Language item in Control Panel. For example, a user whose culture is English (United States) might choose to display currency values as 1.1 USD instead of the default of $1.1. The objects retrieved in the ways discussed previously all reflect these user overrides. If this is undesirable, you can create a object that does not reflect user overrides (and that is also read/write rather than read-only) by calling the constructor and supplying a value of false for the argument. The following example provides an illustration for a system whose current culture is English (United States) and whose currency symbol has been changed from the default of $ to USD.

code reference: System.Globalization.NumberFormatInfo.Class.Instantiate#3

If the property is set to true, the properties , , and are also retrieved from the user settings. If the user settings are incompatible with the culture associated with the object (for example, if the selected calendar is not one of the calendars listed by the property), the results of the methods and the values of the properties are undefined.

## Instantiating a NumberFormatInfo object for the invariant culture

The invariant culture represents a culture that is culture-insensitive. It is based on the English language but not on any specific English-speaking country/region. Although the data of specific cultures can be dynamic and can change to reflect new cultural conventions or user preferences, the data of the invariant culture does not change. A object that represents the formatting conventions of the invariant culture can be used for formatting operations in which result strings should not vary by culture.

You can instantiate a object that represents the formatting conventions of the invariant culture in the following ways:

By retrieving the value of the property. The returned object is read-only.

By retrieving the value of the property from the object that is returned by the property. The returned object is read-only.

By calling the parameterless class constructor. The returned object is read/write.

The following example uses each of these methods to instantiate a object that represents the invariant culture. It then indicates whether the object is read-only,

code reference: System.Globalization.NumberFormatInfo.Class.Instantiate#4

## Instantiating a NumberFormatInfo object for a specific culture

A specific culture represents a language that is spoken in a particular country/region. For example, en-US is a specific culture that represents the English language spoken in the United States, and en-CA is a specific culture that represents the English language spoken in Canada. You can instantiate a object that represents the formatting conventions of a specific culture in the following ways:

By calling the method and retrieving the value of the returned object's property. The returned object is read-only.

By passing a object that represents the culture whose object you want to retrieve to the static method. The returned object is read/write.

By calling the method and retrieving the value of the returned object's property. The returned object is read/write.

By calling one of the class constructors and retrieving the value of the returned object's property. The returned object is read/write.

The following example uses these four ways to create a object that reflects the formatting conventions of the Indonesian (Indonesia) culture. It also indicates whether each object is read-only.

code reference: System.Globalization.NumberFormatInfo.Class.Instantiate#5

## Instantiating a NumberFormatInfo object for a neutral culture

A neutral culture represents a culture or language that is independent of a country/region. It is typically the parent of one or more specific cultures. For example, fr is a neutral culture for the French language and the parent of the fr-FR culture. You create a object that represents the formatting conventions of a neutral culture in the same way that you create a object that represents the formatting conventions of a specific culture.

In the net_v35_short and earlier versions, trying to retrieve a object that reflects the formatting conventions of a neutral culture throws a exception.

However, because it is independent of a specific country/region, a neutral culture lacks culture-specific formatting information. Rather than populating the object with generic values, the .NET Framework returns a object that reflects the formatting conventions of a specific culture that is a child of the neutral culture. For example, the object for the neutral en culture reflects the formatting conventions of the en-US culture, and the object for the fr culture reflects the formatting conventions of the fr-FR culture.

You can use code like the following to determine which specific culture's formatting conventions each neutral culture represents.

code reference: System.Globalization.NumberFormatInfo.Class.Instantiate#6

## NumberFormatInfo and dynamic data

The culture-specific data for formatting numeric values provided by the class is dynamic, just like the cultural data provided by the class. You should not make any assumptions about the stability of values for objects that are associated with particular objects. Only the data provided by the invariant culture and its associated object is stable. Other data can change between application sessions, or even within a single session, for the following reasons:

System updates. Cultural preferences such as the currency symbol or currency formats change over time. When this happens, Windows Update includes changes to the property value for a particular culture.

Replacement cultures. The class can be used to replace the data of an existing culture.

Cascading changes to property values. A number of culture-related properties can change at run time, which, in turn, causes data to change. For example, the current culture can be changed either programmatically or through user action. When this happens, the object returned by the property changes to an object associated with the current culture.

User preferences. Users of your application might override some of the values associated with the current system culture through the region and language options in Control Panel. For example, users might choose a different currency symbol or a different decimal separator symbol. If the property is set to true (its default value), the properties of the object are also retrieved from the user settings.

Starting with the .NET Framework 2.0, all user-overridable properties of a object are initialized when the object is created. There is still a possibility of inconsistency, because neither object creation nor the user override process is atomic, and the relevant values may change during object creation. However, these inconsistencies should be extremely rare.

You can control whether user overrides are reflected in objects that represent the same culture as the current thread culture. The following table lists the ways in which a object can be retrieved and indicates whether the resulting object reflects user overrides.

Source of CultureInfo and NumberFormatInfo object

Reflects user overrides

CultureInfo.CurrentCulture.NumberFormat property

Yes

property

Yes

method

Yes

method

No

constructor

Yes

constructor

Depends on value of parameter

Unless there is a compelling reason to do otherwise, you should respect user overrides when you use the object in client applications to format and parse user input or to display numeric data. For server applications or unattended applications, you should not respect user overrides. However, if you are using the object either explicitly or implicitly to persist numeric data in string form, you should either use a object that reflects the formatting conventions of the invariant culture, or you should specify a custom numeric format string that you use regardless of culture.

## IFormatProvider, NumberFormatInfo, and numeric formatting

A object is used implicitly or explicitly in all numeric formatting operations. These include calls to the following methods:

All numeric formatting methods, such as , , and .

The major composite formatting method, .

Other composite formatting methods, such as and .

All numeric formatting operations make use of an implementation. The interface includes a single method, . This is a callback method that is passed a object that represents the type needed to provide formatting information. The method is responsible for returning either an instance of that type or null, if it cannot provide an instance of the type. The .NET Framework provides two implementations for formatting numbers:

The class, which represents a specific culture (or a specific language in a specific country/region). In a numeric formatting operation, the method returns the object associated with its property.

The class, which provides information about the formatting conventions of its associated culture. The method returns an instance of itself.

If an implementation is not provided to a formatting method explicitly, a object returned by the property that represents the current thread culture is used.

The following example illustrates the relationship between the interface and the class in formatting operations by defining a custom implementation. Its method displays the type name of the object requested by the formatting operation. If the interface is requesting a object, this method provides the object for the current thread culture. As the output from the example shows, the method requests a object to provide formatting information, whereas the method requests and objects as well as an implementation.

code reference: System.Globalization.NumberFormatInfo.Class#1

If an implementation is not explicitly provided in a numeric formatting method call, the method calls the CultureInfo.CurrentCulture.GetFormat method, which returns the object that corresponds to the current thread culture.

## Format strings and NumberFormatInfo properties

Every formatting operation uses either a standard or a custom numeric format string to produce a result string from a number. In some cases, the use of a format string to produce a result string is explicit, as in the following example. This code calls the method to convert a value to a number of different string representations by using the formatting conventions of the en-US culture.

code reference: System.Globalization.NumberFormatInfo.Class#2

In other cases, the use of a format string is implicit. For example, in the following method calls to the default or parameterless method, the value of the instance is formatted by using the general ("G") format specifier and the conventions of the current culture, which in this case is the en-US culture.

code reference: System.Globalization.NumberFormatInfo.Class#3

Each standard numeric format string uses one or more properties to determine the pattern or the symbols used in the result string. Similarly, each custom numeric format specifier except "0" and "#" insert symbols in the result string that are defined by properties. The following table lists the standard and custom numeric format specifiers and their associated properties. To change the appearance of the result string for a particular culture, see the Modifying NumberFormatInfo properties section. For details about the use of these format specifiers, see Standard Numeric Format Strings and Custom Numeric Format Strings.

Format specifier

Associated properties

"C" or "c" (currency format specifier)

, to define the default number of fractional digits.

, to define the decimal separator symbol.

, to define the group or thousands separator.

, to define the sizes of integral groups.

, to define the pattern of negative currency values.

, to define the pattern of positive currency values.

, to define the currency symbol.

, to define the negative sign symbol.

"D" or "d" (decimal format specifier)

, to define the negative sign symbol.

"E" or "e" (exponential or scientific format specifier)

, to define the negative sign symbol in the mantissa and exponent.

, to define the decimal separator symbol.

, to define the positive sign symbol in the exponent.

"F" or "f" (fixed-point format specifier)

, to define the negative sign symbol.

, to define the default number of fractional digits.

, to define the decimal separator symbol.

"G" or "g" (general format specifier)

, to define the negative sign symbol.

, to define the decimal separator symbol.

, to define the positive sign symbol for result strings in exponential format.

"N" or "n" (number format specifier)

, to define the negative sign symbol.

, to define the default number of fractional digits.

, to define the decimal separator symbol.

, to define the group separator (thousands) symbol.

, to define the number of integral digits in a group.

, to define the format of negative values.

"P" or "p" (percent format specifier)

, to define the negative sign symbol.

, to define the default number of fractional digits.

, to define the decimal separator symbol.

, to define the group separator symbol.

, to define the number of integral digits in a group.

, to define the placement of the percent symbol and the negative symbol for negative values.

, to define the placement of the percent symbol for positive values.

, to define the percent symbol.

"R" or "r" (round-trip format specifier)

, to define the negative sign symbol.

, to define the decimal separator symbol.

, to define the positive sign symbol in an exponent.

"X" or "x" (hexadecimal format specifier)

None.

"." (decimal point custom format specifier)

, to define the decimal separator symbol.

"," (group separator custom format specifier)

, to define the group (thousands) separator symbol.

"%" (percentage placeholder custom format specifier)

, to define the percent symbol.

"‰" (per mille placeholder custom format specifier)

, to define the per mille symbol.

"E" (exponential notation custom format specifier)

, to define the negative sign symbol in the mantissa and exponent.

, to define the positive sign symbol in the exponent.

Note that the class includes a property that specifies the base 10 digits used by a specific culture. However, the property is not used in formatting operations; only the Basic Latin digits 0 (U+0030) through 9 (U+0039) are used in the result string. In addition, for and values of NaN, PositiveInfinity, and NegativeInfinity, the result string consists exclusively of the symbols defined by the , , and properties, respectively.

## Modifying NumberFormatInfo properties

You can modify the properties of a object to customize the result string produced in a numeric formatting operation. To do this:

Create a read/write copy of a object whose formatting conventions you want to modify. For more information, see the Instantiating a NumberFormatInfo object section.

Modify the property or properties that are used to produce the desired result string. For information about how formatting methods use properties to define result strings, see the Format strings and NumberFormatInfo properties section.

Use the custom object as the argument in calls to formatting methods.

Instead of dynamically modifying a culture's property values each time an application is started, you can use the class to define either a custom culture (a culture that has a unique name and that supplements existing cultures) or a replacement culture (one that is used instead of a specific culture).

The following sections provide some examples.

## Modifying the currency symbol and pattern

The following example modifies a object that that represents the formatting conventions of the en-US culture. It assigns the ISO-4217 currency symbol to the property and defines a pattern for currency values that consists of the currency symbol followed by a space and a numeric value.

code reference: System.Globalization.NumberFormatInfo.Customize#1

## Formatting a national identification number

Many national identification numbers consist exclusively of digits and so can easily be formatted by modifying the properties of a object. For example, a social security number in the United States consists of 9 digits arranged as follows: `XXX-XX-XXXX`. The following example assumes that social security numbers are stored as integer values and formats them appropriately.

code reference: System.Globalization.NumberFormatInfo.Customize#2

## Parsing numeric strings

Parsing involves converting the string representation of a number to a number. Each numeric type in the .NET Framework includes two overloaded parsing methods: Parse and TryParse. The Parse method converts a string to a number and throws an exception if the conversion fails. The TryParse method converts a string to a number, assigns the number to an out argument, and returns a value that indicates whether the conversion succeeded.

The parsing methods implicitly or explicitly use a enumeration value to determine what style elements (such as group separators, a decimal separator, or a currency symbol) can be present in a string if the parsing operation is to succeed. If a value is not provided in the method call, the default is a value that includes the and flags, which specifies that the parsed string can include group symbols, a decimal separator, a negative sign, and white-space characters, or it can be the string representation of a number in exponential notation.

The parsing methods also implicitly or explicitly use a object that defines the specific symbols and patterns that can occur in the string to be parsed. If a object is not provided, the default is the for the current thread culture. For more information about parsing, see the individual parsing methods, such as , , , , , and .

The following example illustrates the culture-sensitive nature of parsing strings. It tries to parse a string that include thousands separators by using the conventions of the en-US, fr-FR, and invariant cultures. A string that includes the comma as a group separator and the period as a decimal separator fails to parse in the fr-FR culture, and a string with white space as a group separator and a comma as a decimal separator fails to parse in the en-US and invariant cultures.

code reference: System.Globalization.NumberFormatInfo.Class#4

Parsing generally occurs in two contexts:

As an operation that is designed to convert user input into a numeric value.

As an operation that is designed to round-trip a numeric value; that is, to deserialize a numeric value that was previously serialized as a string.

The following sections discuss these two operations in greater detail.

## Parsing user strings

When you are parsing numeric strings input by the user, you should always instantiate a object that reflects the user's cultural settings. For information about how to instantiate a object that reflects user customizations, see the NumberFormatInfo and dynamic data section.

The following example illustrates the difference between a parsing operation that reflects user cultural settings and one that does not. In this case, the default system culture is en-US, but the user has defined "," as the decimal symbol and "." as the group separator in Control Panel, Region and Language. Ordinarily, these symbols are reversed in the default en-US culture. When the user enters a string that reflects user settings, and the string is parsed by a object that also reflects user settings (overrides), the parsing operation returns a correct result. However, when the string is parsed by a object that reflects standard en-US cultural settings, it mistakes the comma symbol for a group separator and returns an incorrect result.

code reference: System.Globalization.NumberFormatInfo.Class#5

## Serializing and deserializing numeric data

When numeric data is serialized in string format and later deserialized and parsed, the strings should be generated and parsed by using the conventions of the invariant culture. The formatting and parsing operations should never reflect the conventions of a specific culture. If culture-specific settings are used, the portability of the data is strictly limited; it can be successfully deserialized only on a thread whose culture-specific settings are identical to those of the thread on which it was serialized. In some cases, this means that the data cannot even be successfully deserialized on the same system on which it was serialized.

The following example illustrates what can happen when this principle is violated. Floating-point values in an array are converted to strings when the current thread uses the culture-specific settings of the en-US culture. The data is then parsed by a thread that uses the culture-specific settings of the en-GB culture. In this case, although each parsing operation succeeds, the data does not round-trip successfully and data corruption occurs. In other cases, a parsing operation could fail and a exception could be thrown.

code reference: System.Globalization.NumberFormatInfo.Class#6

Provides culture-specific information for formatting and parsing numeric values.

- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0

  The properties of the new instance can be modified if your application needs user-defined formatting.

  Initializes a new writable instance of the class that is culture-independent (invariant).

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Object

  The clone is writable even if the original object is read-only. Therefore, the properties of the clone can be modified with user-defined patterns.

  A shallow copy of an object is a copy of the object only. If the object contains references to other objects, the shallow copy will not create copies of the referred objects. It will refer to the original objects instead. On the other hand, a deep copy of an object creates a copy of the object and a copy of everything directly or indirectly referenced by that object. In the case of a object, a shallow copy is sufficient for copying all instance properties, because all properties that return object references are static (Shared in Visual Basic).

  Creates a shallow copy of the object.

  A new object copied from the original object.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32

  A containing the number of decimal places in currency values.

  The value specified for a set operation is less than 0 or greater than 99. The current instance is read-only and a set operation was attempted.

  The property is used with the "C" standard format string without a precision specifier in numeric formatting operations. It defines the default number of fractional digits that appear after the decimal separator. This value is overridden if a precision specifier is used. For more information, see Standard Numeric Format Strings.

  Gets or sets the number of decimal places to use in currency values.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  A containing the decimal separator used in currency values.

  The value specified for a set operation is a null reference. The current instance is read-only and a set operation was attempted.

  The initial value of this property is derived from the settings in the Region and Language item in Control Panel.

  The property is used with the "C" standard format string to define the symbol that separates integral from fractional digits. For more information, see Standard Numeric Format Strings.

  Gets or sets the string to use as the decimal separator in currency values.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  A containing the group separator used in currency values.

  The value specified for a set operation is a null reference. The current instance is read-only and a set operation was attempted.

  The initial value of this property is derived from the settings in the Regional and Language item in Control Panel.

  The property is used with the "C" standard format string to define the symbol that separates groups of integers. For more information, see Standard Numeric Format Strings.

  Gets or sets the string that separates groups of digits to the left of the decimal in currency values.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32[]

  A array containing elements that define the number of digits in each group in currency values.

  The array specified for a set operation is a null reference.

  One of the elements in the array specified for a set operation is not between 0 and 9.

  The current instance is read-only and a set operation was attempted.

  The following example demonstrates the effects of different property values.

  `using System; using System.Globalization; class Test { public static void Main() { NumberFormatInfo nfi = new NumberFormatInfo(); decimal myMoney = 9999999994444333221.00m; nfi.CurrencyGroupSizes = new int[] {1,2,3,4,0}; Console.WriteLine("{0}",myMoney.ToString("C",nfi)); myMoney = 123456789123456.78m; nfi.CurrencyGroupSizes = new int[] {3}; Console.WriteLine("{0}",myMoney.ToString("C",nfi)); nfi.CurrencyGroupSizes = new int[] {3,0}; Console.WriteLine("{0}",myMoney.ToString("C",nfi)); } }`

  The output is

  $999999999,4444,333,22,1.00

  $123,456,789,123,456.78

  $123456789123,456.78

  One of the elements in the array specified for a set operation is not between 0 and 9.

  -or-

  The array contains an element, other than the last element, that is set to 0.

  The property is used with the "C" standard format string to define the number of digits that appear in integral groups. For more information, see Standard Numeric Format Strings. Every element in the one-dimensional array must be an integer from 1 through 9. The last element can be 0.

  The first element of the array defines the number of elements in the least significant group of digits immediately to the left of the . Each subsequent element refers to the next significant group of digits to the left of the previous group. If the last element of the array is not 0, the remaining digits are grouped based on the last element of the array. If the last element is 0, the remaining digits are not grouped.

  For example, if the array contains { 3, 4, 5 }, the digits are grouped similar to "$55,55555,55555,55555,4444,333.00". If the array contains { 3, 4, 0 }, the digits are grouped similar to "$55555555555555555,4444,333.00".

  Gets or sets the number of digits in each group to the left of the decimal in currency values.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32

  A between 0 and 15 inclusive, which specifies the format of negative currency values.

  The value specified for a set operation is less than 0 or greater than 15. The current instance is read-only and a set operation was attempted.

  The following example demonstrates the effects of different property values.

  `using System; using System.Globalization; class Test { public static void Main() { NumberFormatInfo nfi = new NumberFormatInfo(); decimal myMoney = -9999999999999.00m; for (int i = 0; i<=15; i++) { nfi.CurrencyNegativePattern = i; Console.WriteLine("pattern # {0}: {1}",i,myMoney.ToString("C",nfi)); } } }`

  The output is

  pattern # 0: ($9,999,999,999,999.00)

  pattern # 1: -$9,999,999,999,999.00

  pattern # 2: $-9,999,999,999,999.00

  pattern # 3: $9,999,999,999,999.00-

  pattern # 4: (9,999,999,999,999.00$)

  pattern # 5: -9,999,999,999,999.00$

  pattern # 6: 9,999,999,999,999.00-$

  pattern # 7: 9,999,999,999,999.00$-

  pattern # 8: -9,999,999,999,999.00 $

  pattern # 9: -$ 9,999,999,999,999.00

  pattern # 10: 9,999,999,999,999.00 $-

  pattern # 11: $ 9,999,999,999,999.00-

  pattern # 12: $ -9,999,999,999,999.00

  pattern # 13: 9,999,999,999,999.00- $

  pattern # 14: ($ 9,999,999,999,999.00)

  pattern # 15: (9,999,999,999,999.00 $)

  The property is used with the "C" standard format string to define the pattern of negative currency values. For more information, see Standard Numeric Format Strings. This property has one of the values in the following table. The symbol "$" is the , the symbol "-" is the , and is a number.

  Value

  Associated pattern

  0

  ($n)

  1

  -$n

  2

  $-n

  3

  $n-

  4

  (n$)

  5

  -n$

  6

  n-$

  7

  n$-

  8

  -n $

  9

  -$ n

  10

  n $-

  11

  $ n-

  12

  $ -n

  13

  n- $

  14

  ($ n)

  15

  (n $)

  Gets or sets the format pattern for negative currency values.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32

  A between 0 and 3 inclusive, containing the format of positive currency values.

  The value specified for a set operation is less than 0 or greater than 3. The current instance is read-only and a set operation was attempted.

  The following example demonstrates the effects of different property values.

  `using System; using System.Globalization; class Test { public static void Main() { NumberFormatInfo nfi = new NumberFormatInfo(); decimal myMoney = 9999999999999.00m; for (int i = 0; i<=3; i++) { nfi.CurrencyPositivePattern = i; Console.WriteLine("pattern # {0}: {1}",i,myMoney.ToString("C",nfi)); } } }`

  The output is

  pattern # 0: $9,999,999,999,999.00

  pattern # 1: 9,999,999,999,999.00$

  pattern # 2: $ 9,999,999,999,999.00

  pattern # 3: 9,999,999,999,999.00 $

  The property is used with the "C" standard format string to define pattern of positive currency values. For more information, see Standard Numeric Format Strings. This property has one of the values in the following table. The symbol "$" is the and is a number.

  Value

  Associated pattern

  0

  $n

  1

  n$

  2

  $ n

  3

  n $

  Note that the pattern does not support a positive sign.

  Gets or sets the format pattern for positive currency values.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  A containing the currency symbol.

  The value specified for a set operation is a null reference. The current instance is read-only and a set operation was attempted.

  The string assigned to the property is included in the result string when a numeric value is formatted with the "C" standard numeric format specifier.

  Gets or sets the string to use as the currency symbol.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Globalization.NumberFormatInfo

  A read-only containing the settings for the current system culture.

  Retrieving a object from the property is equivalent to retrieving a object from the CultureInfo.CurrentCulture.NumberFormat property.

  Gets a read-only that formats values based on the current culture.

  0
- Property
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(false)
  System.Globalization.DigitShapes To be added.

  The property is reserved for future use. Currently, it is not used in either parsing or formatting operations for the current object.

  Gets or sets a value that specifies how the graphical user interface displays the shape of a digit.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Object ``

  The Format(String, IFormatProvider) methods supported by the base data types invoke this method when the current is passed as the parameter. This method implements .

  Gets an object of the specified type that provides a number formatting service.

  The current , if is the same as the type of the current ; otherwise, null.

  The of the required formatting service. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Globalization.NumberFormatInfo ``

  This method uses the method of using as the Type parameter. If is null or if returns null, this method returns .

  Your application gets a object for a specific culture using one of the following methods:

  Through the property.

  Through the method where is a .

  A object is 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 class.

  Gets the associated with the specified .

  The associated with the specified .

  The used to get the .
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Globalization.NumberFormatInfo

  A read-only with property values which are universally supported. The property values of the returned are not impacted by changes to the current culture.

  This object returned by this property does not change, regardless of the current culture. It represents the formatting conventions of the invariant culture, which is a culture associated with the English language but not with any country/region. The invariant culture is used in formatting operations that are culture-independent or that produce result strings suitable for display across multiple cultures.

  Gets a read-only object that is culture-independent (invariant).

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  if the current instance is read-only; otherwise .

  Attempting to perform an assignment to a property of a read-only causes an .

  You can call the method to create a read/write object from a read-only object, as the following example illustrates.

  code reference: System.Globalization.NumberFormatInfo.IsReadOnly#1

  Gets a value that indicates whether this object is read-only.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  A containing the symbol for NaN values.

  The value specified for a set operation is a null reference. The current instance is read-only and a set operation was attempted.

  For more information on NaN values, see or .

  Gets or sets the string that represents the IEEE NaN (not a number) value.

  0
- Property
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(false)
  System.String[] To be added.

  The character set that is specified by the property has no effect on parsing or formatting operations. Only the Basic Latin digits 0 (U+0030) through 9 (U+0039) are used when formatting or parsing numeric values or date and time values.

  Gets or sets a string array of native digits equivalent to the Western digits 0 through 9.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  A containing the symbol for negative infinity.

  The value specified for a set operation is a null reference. The current instance is read-only and a set operation was attempted.

  For more information on negative infinity, see or .

  Gets or sets the string that represents negative infinity.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  A containing the symbol that indicates a value is negative.

  The culture-invariant value for this property is "-".

  The value specified for a set operation is a null reference. The current instance is read-only and a set operation was attempted.

  Gets or sets the string that denotes that the associated number is negative.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32

  A containing the number of decimal places for numeric values.

  The value specified for a set operation is less than 0 or greater than 99. The current instance is read-only and a set operation was attempted.

  The property is used with the "F" and "N" standard format strings without a precision specifier in numeric formatting operations. It defines the default number of fractional digits that appear after the decimal separator. This value is overridden if a precision specifier is used. For more information, see Standard Numeric Format Strings.

  Gets or sets the number of decimal places to use in numeric values.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  A containing the decimal separator.

  The value specified for a set operation is a null reference. The current instance is read-only and a set operation was attempted.

  The property is used with the "E", "F", "G", "N", and "R" standard format strings to define the symbol that separates integral from fractional digits. For more information, see Standard Numeric Format Strings.

  The initial value of this property is derived from the settings in the Region and Language item in Control Panel.

  Gets or sets the string to use as the decimal separator in numeric values.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  A containing the group separator.

  The value specified for a set operation is a null reference. The current instance is read-only and a set operation was attempted.

  The property is used with the "N" standard format string to define the symbol that separates groups of integers. For more information, see Standard Numeric Format Strings.

  The initial value of this property is derived from the settings in the Region and Language item in Control Panel.

  Gets or sets the string that separates groups of digits to the left of the decimal in numeric values.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32[]

  A array containing elements that define the number of digits in each group in numeric values.

  The array specified for a set operation is a null reference. One of the elements in the array specified for a set operation is not between 0 and 9. The current instance is read-only and a set operation was attempted.

  The following example demonstrates the effects of different property values.

  `using System; using System.Globalization; class Test { public static void Main() { NumberFormatInfo nfi = new NumberFormatInfo(); decimal data = 9999999994444333221.00m; nfi.NumberGroupSizes = new int[] {1,2,3,4,0}; Console.WriteLine("{0}",data.ToString("N",nfi)); data = 123456789123456.78m; nfi.NumberGroupSizes = new int[] {3}; Console.WriteLine("{0}",data.ToString("N",nfi)); nfi.NumberGroupSizes = new int[] {3,0}; Console.WriteLine("{0}",data.ToString("N",nfi)); } }`

  The output is

  999999999,4444,333,22,1.00

  123,456,789,123,456.78

  123456789123,456.78

  The value of the property affects the result of number values that are formatted by using the "N" standard numeric format string. If a custom numeric format string or other standard numeric format strings are used, the value of the property is ignored.

  Every element in the one-dimensional array must be an integer from 1 through 9. The last element can be 0.

  The first element of the array defines the number of elements in the least significant group of digits immediately to the left of the . Each subsequent element refers to the next significant group of digits to the left of the previous group. If the last element of the array is not 0, the remaining digits are grouped based on the last element of the array. If the last element is 0, the remaining digits are not grouped.

  For example, if the array contains { 3, 4, 5 }, the digits are grouped similar to "55,55555,55555,55555,4444,333.00". If the array contains { 3, 4, 0 }, the digits are grouped similar to "55555555555555555,4444,333.00".

  Gets or sets the number of digits in each group to the left of the decimal in numeric values.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32

  A between 0 and 4 inclusive that specifies the format of negative values.

  The value specified for a set operation is less than 0 or greater than 4. The current instance is read-only and a set operation was attempted.

  The following example demonstrates the effects of different property values.

  `using System; using System.Globalization; class Test { public static void Main() { NumberFormatInfo nfi = new NumberFormatInfo(); Double data = -9999999999999.00; for (int i = 0; i<=4; i++) { nfi.NumberNegativePattern = i; Console.WriteLine("pattern # {0}: {1}",i,data.ToString("N",nfi)); } } }`

  The output is

  pattern # 0: (9,999,999,999,999.00)

  pattern # 1: -9,999,999,999,999.00

  pattern # 2: - 9,999,999,999,999.00

  pattern # 3: 9,999,999,999,999.00-

  pattern # 4: 9,999,999,999,999.00 -

  The property defines the format of negative values formatted with the "N" standard numeric format string. This property has one of the values in the following table. The symbol "-" is the and is a number.

  Value

  Associated pattern

  0

  (n)

  1

  -n

  2

  - n

  3

  n-

  4

  n -

  Gets or sets the format pattern for negative numeric values.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32

  A containing the number of decimal places in percent values.

  The value specified for a set operation is less than 0 or greater than 99. The current instance is read-only and a set operation was attempted.

  The property is used with the "P" standard format string without a precision specifier in numeric formatting operations. It defines the default number of fractional digits that appear after the decimal separator. This value is overridden if a precision specifier is used. For more information, see Standard Numeric Format Strings.

  Gets or sets the number of decimal places to use in percent values.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  A containing the decimal separator used in percent values.

  The value specified for a set operation is a null reference. The current instance is read-only and a set operation was attempted.

  The property is used with the "P" standard format string to define the symbol that separates integral from fractional digits. For more information, see Standard Numeric Format Strings.

  Gets or sets the string to use as the decimal separator in percent values.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  A containing the group separator symbol used in percent values.

  The value specified for a set operation is a null reference. The current instance is read-only and a set operation was attempted.

  The property is used with the "P" standard format string to define the symbol that separates groups of integers. For more information, see Standard Numeric Format Strings.

  Gets or sets the string that separates groups of digits to the left of the decimal in percent values.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32[]

  A array containing elements that define the number of digits in each group in percent values.

  The array specified for a set operation is a null reference.

  One of the elements in the array specified for a set operation is not between 0 and 9.

  The current instance is read-only and a set operation was attempted.

  The following example demonstrates the effects of different property values.

  `using System; using System.Globalization; class Test { public static void Main() { NumberFormatInfo nfi = new NumberFormatInfo(); decimal data = 9999999994444333221.00m; nfi.PercentGroupSizes = new int[] {1,2,3,4,0}; Console.WriteLine("{0}",data.ToString("P",nfi)); data = 123456789123456.78m; nfi.PercentGroupSizes = new int[] {3}; Console.WriteLine("{0}",data.ToString("P",nfi)); nfi.PercentGroupSizes = new int[] {3,0}; Console.WriteLine("{0}",data.ToString("P",nfi)); } }`

  The output is

  99999999944,4433,322,10,0.00 %

  12,345,678,912,345,678.00 %

  12345678912345,678.00 %

  One of the elements in the array specified for a set operation is not between 0 and 9.

  -or-

  The array contains an element, other than the last element, that is set to 0.

  The property is used with the "P" standard format string to define the number of digits that appear in integral groups. For more information, see Standard Numeric Format Strings. Every element in the one-dimensional array must be an integer from 1 through 9. The last element can be 0.

  The first element of the array defines the number of elements in the least significant group of digits immediately to the left of the . Each subsequent element refers to the next significant group of digits to the left of the previous group. If the last element of the array is not 0, the remaining digits are grouped based on the last element of the array. If the last element is 0, the remaining digits are not grouped.

  For example, if the array contains { 3, 4, 5 }, the digits are grouped similar to "55,55555,55555,55555,4444,333.00%". If the array contains { 3, 4, 0 }, the digits are grouped similar to "55555555555555555,4444,333.00%".

  Gets or sets the number of digits in each group to the left of the decimal in percent values.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32

  A between 0 and 2 inclusive that specifies the format of negative percent values.

  The value specified for a set operation is less than 0 or greater than 2. The current instance is read-only and a set operation was attempted.

  The following example demonstrates the effects of different property values.

  `using System; using System.Globalization; class Test { public static void Main() { NumberFormatInfo nfi = new NumberFormatInfo(); decimal data = -.9900m; for (int i = 0; i<=2 ; i++) { nfi.PercentNegativePattern = i; Console.WriteLine("pattern # {0}: {1}",i,data.ToString("P",nfi)); } } }`

  The output is

  pattern # 0: -99.00 %

  pattern # 1: -99.00%

  pattern # 2: -%99.00

  The property is used with the "P" standard format string to define the pattern of negative percentage values. For more information, see Standard Numeric Format Strings. This property has one of the values in the following table. The symbol "%" is the , the symbol "-" is the , and is a number. Values 3-11 were introduced in the .NET Framework 2.0 and cannot be used in earlier versions.

  Value

  Associated pattern

  0

  -n %

  1

  -n%

  2

  -%n

  3

  %-n

  4

  %n-

  5

  n-%

  6

  n%-

  7

  -% n

  8

  n %-

  9

  % n-

  10

  % -n

  11

  n- %

  Gets or sets the format pattern for negative percent values.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32

  A between 0 and 2 inclusive that specifies the format of positive percent values.

  The value specified for a set operation is less than 0 or greater than 2. The current instance is read-only and a set operation was attempted.

  The following example demonstrates the effects of different property values.

  `using System; using System.Globalization; class Test { public static void Main() { NumberFormatInfo nfi = new NumberFormatInfo(); decimal data = .9900m; for (int i = 0; i<=2 ; i++) { nfi.PercentPositivePattern = i; Console.WriteLine("pattern # {0}: {1}",i,data.ToString("P",nfi)); } } }`

  The output is

  pattern # 0: 99.00 %

  pattern # 1: 99.00%

  pattern # 2: %99.00

  The property is used with the "P" standard format string to define pattern of positive percentage values. For more information, see Standard Numeric Format Strings. This property has one of the values in the following table. The symbol "%" is the and is a number.

  Value

  Associated pattern

  0

  n %

  1

  n%

  2

  %n

  3

  % n

  Gets or sets the format pattern for positive percent values.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  A containing the percent symbol.

  The value specified for a set operation is a null reference. The current instance is read-only and a set operation was attempted.

  The string assigned to the property is included in the result string when a numeric value is formatted with the "P" standard numeric format specifier or with a format string that includes the "%" custom numeric format specifier.

  Gets or sets the string to use as the percent symbol.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  A containing the per mille symbol.

  The value specified for a set operation is a null reference. The current instance is read-only and a set operation was attempted.

  The string assigned to the property is included in the result string when a numeric value is formatted with a format string that includes the "‰" custom numeric format specifier.

  Gets or sets the string to use as the per mille symbol.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  A containing the symbol for positive infinity.

  The value specified for a set operation is a null reference. The current instance is read-only and a set operation was attempted.

  For more information on positive infinity, see or .

  Gets or sets the string that represents positive infinity.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  A containing the symbol that indicates the value is positive.

  The value specified for a set operation is a null reference The current instance is read-only and a set operation was attempted.

  This property is used only for parsing numeric strings, not for formatting.

  Gets or sets the string that denotes that the associated number is positive.

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Globalization.NumberFormatInfo `` is a null reference.

  This wrapper prevents any modifications to .

  Attempting to perform an assignment to a property of a read-only causes an .

  Returns a read-only wrapper.

  A read-only wrapper around .

  The to wrap. 0
0