Converting C# byte to BitArray
问题 Is there any predefined function available to convert a byte into BitArray ? One way would be to inspect every bit of the byte value and then perform bitwise operation. I was wondering if there is any way which is more straightforward than this. 回答1: Yes, using the appropriate BitArray() constructor as described here: var bits = new BitArray(arrayOfBytes); You can call it with new BitArray(new byte[] { yourBite }) to create an array of one byte. 回答2: if you have a byte number or even an