简单的问题:
我如何判断字节中的哪些位设置为 0,哪些设置为 1
例如:
//That code would obviously wont work, but how do i make something similar that would work?
byte myByte = 0X32;
foreach(bool bit in myByte)
{
Console.WriteLine(bit);
}
//Part 2 revert
bool[] bits = new bool[8];
bits[0] = 0
bits[1] = 0
bits[2] = 0
bits[3] = 0
bits[4] = 0
bits[5] = 1
bits[6] = 0
bits[7] = 0
byte newByte = (byte)bits;
整个互联网充满了例子,但我就是想不通