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.
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.