Format int in Console.WriteLine

image_pdfimage_print
   
  

using System;
public class TestConsoleApp
{
    public static void Main(string[] args)
    {
        Console.WriteLine(123);
        Console.WriteLine("{0}", 123);
        Console.WriteLine("{0:D3}", 123);
    }
}

   
     


This entry was posted in Data Types. Bookmark the permalink.