Laszlo,
You can use the CopyTo method to copy the bits back into an array of
byte, bool, and int, if you wish. However, for other types, this will not
work. For those types, you might have to use the BitArray class to swap the
bits around, and then get a byte array representing the flipped bits. Once
you have that, you can use the BitConverter class to convert the byte array
to whatever type you wish.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Laszlo Szijarto" <ls*******@nospam.mrdoc.cc> wrote in message
news:c8**********@sulawesi-fi.lerc.nasa.gov...
In C#, wha't the best way to reveser the bit order of a data type and then
convert it back to that datatype?
So, take a byte, reverse bits, convert it back to a byte. I tried to get
a BitArray and then call Array.Reverse(), but how to convert back to byte?
How about flipping an odd number of bits, say a group of 4 bits, then
converting the 4 bits back to an int equivalent?
Thanks you in advance for your help,
Laszlo