How to use Byte.ToString to get HEX string?

  • Thread starter Thread starter gg
  • Start date Start date
G

gg

Hello, every body:
in C++ we can use springf("02X",byte) to get the string like following:
"0D","AB","9C"...
but in C# i use Byte.ToString("X") can get "D","AB","9C"...
how to get like "0D"?

Thanks.
 
Hello, every body:
in C++ we can use springf("02X",byte) to get the string like following:
"0D","AB","9C"...
but in C# i use Byte.ToString("X") can get "D","AB","9C"...
how to get like "0D"?

If you always want two digits:

ToString("X2")
 
Back
Top