converting bitarray to int64

  • Thread starter Thread starter vidishasharma
  • Start date Start date
V

vidishasharma

I have a bitarray with values as {true,false,true,true}

I want to convert this bitarray to Int64. How can I do the same,

when I take
byte[] testbytes = new byte[bit1.Length];
bit1.CopyTo(testbytes, 0)

where bit1 is my bit array
I get everything as zero

When I take
bool[] testbytesbool = new bool[bit1.Length];
bit1.CopyTo(testbytesbool , 0)

I get true and false at proper places.However this is not geting
converted to in64.

How do I conver this to in64.

This is just an example as my bitarry is comprised of 200000 values.
therefore I want to convert it to int64.
 
I have a bitarray with values as {true,false,true,true}

I want to convert this bitarray to Int64. How can I do the same,

when I take
byte[] testbytes = new byte[bit1.Length];
bit1.CopyTo(testbytes, 0)

where bit1 is my bit array
I get everything as zero

When I take
bool[] testbytesbool = new bool[bit1.Length];
bit1.CopyTo(testbytesbool , 0)

I get true and false at proper places.However this is not geting
converted to in64.

How do I conver this to in64.

Use the BitConverter class :)
 
I am unable to use the same.

Can you give an example. to convert bool[] to in32 or int 64
 
Bool[] is in my opinion not a bitarray it is an array of booleans.

A bitaray could be {1,0,1,1} decimal value 11

Cor
 
Back
Top