D
Dmitry Bond.
Hi All.
Is it possible to convert a byte to hexadecimal string with leading zero in
C#?
Unfortunately I not found any samples how to do it in .Net. :-(
For decimal numbers I could use String.Format("{0:0#}") or ToString("#0")
but what should I use to obtain hexadecimal representation of a number?
Is it possible at all?
Or should I use ugly constructions like:
string s = b.ToString("X");
if (s.Length == 1) s = "0" + s;
?
WBR,
Dmitry.
Is it possible to convert a byte to hexadecimal string with leading zero in
C#?
Unfortunately I not found any samples how to do it in .Net. :-(
For decimal numbers I could use String.Format("{0:0#}") or ToString("#0")
but what should I use to obtain hexadecimal representation of a number?
Is it possible at all?
Or should I use ugly constructions like:
string s = b.ToString("X");
if (s.Length == 1) s = "0" + s;
?
WBR,
Dmitry.