Set Currency Group Size in number format in CSharp
Description
The following code shows how to set Currency Group Size in number format.
Example
using System;/*from w w w. ja v a 2 s .com*/
using System.Globalization;
class NumberFormatInfoSample {
public static void Main() {
NumberFormatInfo nfi = new CultureInfo( "en-US", false ).NumberFormat;
Int64 myInt = 123456789012345;
Console.WriteLine( myInt.ToString( "C", nfi ) );
int[] mySizes1 = {2,3,4};
int[] mySizes2 = {2,3,0};
nfi.CurrencyGroupSizes = mySizes1;
Console.WriteLine( myInt.ToString( "C", nfi ) );
nfi.CurrencyGroupSizes = mySizes2;
Console.WriteLine( myInt.ToString( "C", nfi ) );
}
}
The code above generates the following result.