Display value using the standard format specifiers for ulong value : long « Data Types « C# / C Sharp






Display value using the standard format specifiers for ulong value

 

using System;

public class Example
{
   public static void Main()
   {
      ulong value = 163249057;
      // Display value using default ToString method.
      Console.WriteLine(value.ToString());      
      Console.WriteLine();

      // Define an array of format specifiers.
      string[] formats = { "G", "C", "D", "F", "N", "X" };
      // Display value using the standard format specifiers.
      foreach (string format in formats)
         Console.WriteLine("{0} format specifier: {1,16}",format, value.ToString(format));         
   }
}

   
  








Related examples in the same category

1.Compute the distance from the Earth to the sun, in inches. Compute the distance from the Earth to the sun, in inches.
2.Demonstate automatic conversion from long to doubleDemonstate automatic conversion from long to double
3.Unsigned long value
4.Convert long value to KB,MB,GB,TB