Reputation: 941
Taking a look at BitArray's methods, I could not see any method to add a new boolean to the array - so is the size of BitArray static? I am using a lot (millions, maybe tens of millions) of bits so would really love the advantage of BitArray using only 1/8th of space of boolean array - however, I need it to be dynamic. Is the use of List<bool>
my only way to use the dynamic length? Or perhaps List<byte>
and bitwise operations on that - is there some way around that?
Upvotes: 2
Views: 2870
Reputation: 68667
You can create a wrapper class around it which implements IList<bool>
, but uses a BitArray to store the data. Remember, you can resize a BitArray
using the Length property.
Upvotes: 8