I have a small set of code that attempts to bit-shift a 1-bit from the 0 index to the 7 index in a byte. After each bit shift I want to take the int value and convert it to a byte:
for(int t=0; t<8; t++) { int ShiftBit = 0x80 >> t; byte ShiftBitByte = Convert.ToByte(ShiftBit.ToString(),8); } I would expect the outputs to be:
- 0x80
- 0x40
- 0x20
- 0x10
- 0x08
- 0x04
- 0x02
- 0x01
When I run my code I encounter an exception "Additional non-parsable characters are at the end of the string." Is there a better way to capture these bytes?
Thank you
