I'm updating some old code written by another programmer, and i need to do some changes. I have an unsigned integer stored into Short var and need to get its binary code in an array of bool.
How can i do this?
I'm updating some old code written by another programmer, and i need to do some changes. I have an unsigned integer stored into Short var and need to get its binary code in an array of bool.
How can i do this?
In addition to Trevor's answer, you can use a BitVector32
as well:
Dim myValue As UShort = 32
Dim bVector As New BitVector32(CInt(myValue))
BitVector32
is slightly more efficient than BitArray
but is limited to 32 bits. BitVector32
allows you to create sections in the bits for different purposes and treat them as flags.
try this perhaps