Example of a Hexadecimal Format Specifier : Hexadecimal « Data Type « C# / CSharp Tutorial






class MainClass
{
  static void Main()
  {
    // Displays "0x2A"
    System.Console.WriteLine("0x{0:X}", 42);
  }
}








2.11.Hexadecimal
2.11.1.Numeric Formatting: Hexadecimal ({0:X}, {0:x8})
2.11.2.Hexadecimal Literal Value
2.11.3.Example of a Hexadecimal Format Specifier