I have a program written in Delphi is converting 11 to 0xB and 28 to 0x1c. I tried to convert 11 (decimal to Hex) in c# using this:-
var deciValue01 = 11;
var deciValue02 = 28;
var deciValue03 = 13;
System.Diagnostics.Debug.WriteLine(string.Format("11 = {0:x}", deciValue01));
System.Diagnostics.Debug.WriteLine(string.Format("28 = {0:x}", deciValue02));
System.Diagnostics.Debug.WriteLine(string.Format("13 = {0:x}", deciValue03));
but the results I am getting is:-
- 11 = b
- 28 = 1c
- 13 = d
Wondering how to convert 11 to '0xB' and 28 to '0x1c' and 13 to '0xD'? Isn't it I need to change from Decimal to Hex?
Format("0x{0:X}")Oxto the string you generate?