4

Since a boolean actually takes 1 byte of space, a bool[] isn't the most space-efficient way to represent a bit array. Sometimes integers and longs are used as a more efficient bit array, but a long can only hold 64 bits. Is there a more space-efficient way to store arrays of tens of millions bits in limited memory?

All I need to do with this array is to set/clear individual bits and to check whether some bits is 1 or 0, i.e. the only functions I need:

void Set(int index, bool value);
bool Get(int index);
4

1 回答 1

11

I think what you need is BitArray class

于 2013-02-10T15:03:20.580 回答