Display the value with three elements in the GroupSize array in CSharp

Description

The following code shows how to display the value with three elements in the GroupSize array.

Example


using System;/* w ww  . ja v  a 2  s .  c om*/
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 );
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Data Types »




C# Data Types
Bool
Byte
Char
Decimal
Double
Float
Integer
Long
Short
String
C# Array
Array Example
Byte Array
C# Standard Data Type Format
BigInteger
Complex
Currency
DateTime
DateTimeOffset
DateTime Format Parse Convert
TimeSpan
TimeZone
Enum
Null
tuple
var