The comma (,M) determines the field width and justification. : String Format : Data Types C# Source Code


Custom Search

C# Source Code » Data Types » String Format »

 

The comma (,M) determines the field width and justification.








    
 

using System;

public class TestConsoleApp
{
    public static void Main(string[] args)
    {
      Console.WriteLine(
          "{0,5} {1,5}", 123, 456);      // Right-aligned
      Console.WriteLine(
          "{0,-5} {1,-5}", 123, 456);    // Left-aligned
      Console.WriteLine(
          "{0,-10:D6} {1,-10:D6}", 123, 456);

    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Data Types
» String Format