Display the value with zero as the last element in the GroupSize array in CSharp
Description
The following code shows how to display the value with zero as the last element in the GroupSize array.
Example
using System;/*www . j a va2 s . c o m*/
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, 4, 0 };
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 );
}
}
The code above generates the following result.