BitArray Class
Part of my 2008 study notes for exam 70-536 (.NET Framework 2.0).
Overview
- Contains an array of true/false values.
- Resizable through the Length property.
- Supports bitwise operations.
Examples
Setting Values
BitArray a = new BitArray(8);
a.SetAll(false);
a[2] = true;
Xor
BitArray a = new BitArray(8);
a.SetAll(false);
a[2] = true;
BitArray b = new BitArray(8);
b.SetAll(false);
b[2] = false;
BitArray xor = a.Xor(b);
Console.WriteLine(xor[2]);
You May Also Like
ArrayList Class
Resizeable, unordered, index-based collection. Suffers from boxing/unboxing when working with value types. Implements IEnumerator, allowing foreach…
BinaryReader Class and BinaryWriter Class
Used to read and write binary data from streams. Call the correct Read methods when using a BinaryReader.
BitVector32 structure and BitVector32.Section structure
Used to manipulate the bits of a 32 integer. Used to pack multiple small numbers into one when storage is an issue.



