What is the advantage of using a Bitarray
when you can store your bool
values in a bool[]
?
System.Collections.BitArray biArray = new System.Collections.BitArray(8);
biArray[4] = true;
bool[] boArray = new bool[8];
boArray[4] = true;
The bool[]
seems a little more handy to me, because there exist more (extension) methods to work with a array instead of a BitArray
.
I expected to find an existing question here on Stack Overflow about this, but I didn't.
.Or
,.Xor
, etc.) contained inBitArray
. – Enthrone