Compare effect of Negative Pattern in number format in CSharp
Description
The following code shows how to compare effect of Negative Pattern in number format.
Example
using System;//from w ww . jav a2 s .c o m
using System.Globalization;
class SamplesNumberFormatInfo {
public static void Main() {
NumberFormatInfo myNfi = new NumberFormatInfo();
Int64 myInt = -1234;
Console.WriteLine( "Default :{0}", myInt.ToString( "N", myNfi ) );
for ( int i = 0; i <= 4; i++ ) {
myNfi.NumberNegativePattern = i;
Console.WriteLine( "Pattern {0}:{1}", myNfi.NumberNegativePattern, myInt.ToString( "N", myNfi ) );
}
}
}
The code above generates the following result.