Console.WriteLine as hexadecimal
int i=10;
Console.WriteLine("{0:x}", i);
or if you want 'A':
int i=10;
Console.WriteLine("{0:X}", i);
i.ToString("x");
Console.WriteLine ("Hex: {0:X}", nNum);
The X formatter outputs uppercase hex chars. Use a lowercase x for lowercase hex chars.
int i=10;
Console.WriteLine("{0:X4}", i);
Outputs hex with a size specifier.
you can also use string interpolation
int i=10;
Console.WriteLine($"{i:X4}");