Problem:
How do I convert a C# byte into a string so that I can read all 8 digits?
Solution:
Imagine that you have a C# byte named myByte. To get a string containing all 8 binary digits, you can use the following code:
Convert.ToString(myByte, 2).PadLeft(8, '0');
Notes:
Also remember that the Convert.ToString method is in the System namespace.
No comments:
Post a Comment