A int between 0 and 4 inclusive that specifies the format of negative values.
Type Reason ArgumentOutOfRangeException The value specified for a set operation is less than 0 or greater than 4. InvalidOperationException The current instance is read-only and a set operation was attempted.
The NumberFormatInfo.NumberNegativePattern 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 NumberFormatInfo.NegativeSign and n is a number.
0 |
(n) |
1 |
-n |
2 |
- n |
3 |
n- |
4 |
n - |
The following example demonstrates the effects of different NumberFormatInfo.NumberNegativePattern property values.
C# Example
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)