Displays the value with three elements in the GroupSize array.
using System;
using System.Globalization;
class SamplesNumberFormatInfo {
public static void Main() {
NumberFormatInfo myNfi = new NumberFormatInfo();
Int64 myInt = 123456789012345;
Console.WriteLine( "Default :{0}", myInt.ToString( "N", myNfi ) );
myNfi.NumberGroupSizes = new int[] { 2, 3, 4 };
Console.WriteLine( "Grouping ( {0} ):{1}",
PrintArraySet( myNfi.NumberGroupSizes ), myInt.ToString( "N", myNfi ) );
}
public static string PrintArraySet( int[] myArr ) {
string myStr = null;
myStr = myArr[0].ToString();
for ( int i = 1; i < myArr.Length; i++ )
myStr += ", " + myArr[i].ToString();
return( myStr );
}
}
//Default :123,456,789,012,345.00
//Grouping ( 2, 3, 4 ):12,3456,7890,123,45.00
Related examples in the same category