0

I want to have my results in this part of code in a binary format rather than in a hexadecimal!!! How can I do it?????

  string temp = Byte Format.To Hex(result.Data, "", "");

I mean I want to see my results in (0011010...) rather than being converted to a hexadecimal number.

Thanks for you answers in advance.

Ali
  • 1
  • 2

2 Answers2

0

Convert.ToString() should do the job. See Documentation

If you have a single byte it will cast to an int

Convert.ToString((int)yourByte, 2); will convert it to base 2 (binary).

NibblyPig
  • 51,118
  • 72
  • 200
  • 356
0
string temp = Convert.ToString(bytes, "X");  //X means hexadecimal
Ashkan Mobayen Khiabani
  • 33,575
  • 33
  • 102
  • 171