Byte to Binary String C# - Display all 8 digits

前端 未结 4 951
刺人心
刺人心 2020-12-05 22:58

I want to display one byte in textbox. Now I\'m using:

Convert.ToString(MyVeryOwnByte, 2);

But when byte is has 0\'s at begining those 0\'s

4条回答
  •  悲哀的现实
    2020-12-05 23:28

    Pad the string with zeros. In this case it is PadLeft(length, characterToPadWith). Very useful extension methods. PadRight() is another useful method.

提交回复
热议问题