>Has anyone worked with the individual bits in a byte (System.Byte)?
>
>I need to construct a byte by setting the individual bits, and I also need to access the individual bits in a given byte.
>Any help would be welcome.
>
>Thanks,
>Einar
I haven't seen this specifically in .NET, but this is often achieved with bit-wise functions, like bitor, etc. (I don't know how this would be done in .NET; perhaps the operators like single vertical line for bitor, single ampersand for bitand, ...
bitand can be used to reset a bit (set it to zero), bitor to set it (set it to one), bitxor to switch a bit.
To read the value of an individual bit, you can also use bitor.
HTH,
Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)