vb.net - BitArray CopyTo not long enough -


i have converter class borrowed converts bitarray integer can store in registry. bitarray 32 single bits, new bitarray(32).

the problem getting error destination array not long enough on copyto.

is there way around this?

public shared function tonumeral(binary bitarray) integer     if binary nothing         throw new argumentnullexception("binary conversion error: field empty")     end if      dim result = new integer(0) {}     binary.copyto(result, 0)     return result(0) end function 

the integer data type can hold 32 bits. if declare bitarray of size 33 (as clarified in comments), large integer.

you need revise trying accomplish. single integer tonumeral function, can't go past 32 bits of information.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -