convert a byte to an array of bits

E

eggie5

How can I get the bits that compose a byte?

Say I pass a byte of value 10 to my byteToBitArray function, I would
LIKE to get back an array (8 long) of 00001010.

I want that back cause that's the binary representation of the byte 10.

Any idea how to do this?
 
M

Marijan Tadin

How can I get the bits that compose a byte?
Say I pass a byte of value 10 to my byteToBitArray function, I would
LIKE to get back an array (8 long) of 00001010.

I want that back cause that's the binary representation of the byte 10.

Any idea how to do this?

Have a look at System.Collections.BitArray class. Maybe this is what you
need.
 
B

Bruce Wood

In what way do you want the "00001010" represented? As a string of
characters? As an array of integers? As an array of booleans? As an
array of bits?

It all depends upon what you want to get out the other end and what you
want to do with it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top