Description | |
|
A BitArray efficiently holds a single dimension array of Bit (1 and 0) values.
Array elements may be freely added, updated or removed - unlike the less flexible native Array and .Net System.Array types.
A BitArray may be constructed in a number of ways, the simplest requiring a simple count of elements. The final constructor takes a set of 32 bit values from a single dimensional array of Int32 values. The bits are taken from right (least significant) to left (most significant) sequence from each Int32 value.
In BitArray, true equates with 1 and false equates with 0.
|
|
Syntax | |
|
Constructor Create ( | Count : Integer ); | Constructor Create ( |
Count : Integer; Value : Boolean ); | Constructor Create ( |
Values : BitArray ); | Constructor Create ( |
Values : Array of Boolean ); | Constructor Create ( |
Values : Array of Byte ); | Constructor Create ( |
Values : Array of Int32 ); |
|
Methods | |
|
| And | Perform a logical And of one BitArray against another |
| Clone | Make a new BitArray that is a clone of the current BitArray |
| CopyTo | Copies elements from the BitArray to a single dimension array |
| Get | Gets the BitArray element value at a specific index position |
| GetEnumerator | Gets an enumerator to allow reading the elements of the current BitArray |
| Not | Creates a copy of the current BitArray with all values inverted |
| Or | Perform a logical Or of one BitArray against another |
| Set | Sets a BitArray element value on (true) or off (false) |
| SetAll | Sets all BitArray element values either on (true) or off (false) |
| Xor | Perform a logical Exclusive Or of one BitArray against another |
|
|
|
Properties | |
|
Count | | Integer | | Gets the number of elements contained in the BitArray. |
IsReadOnly | | Boolean | | Gets a value indicating whether the BitArray is read-only. Always false! |
IsSynchronized | | Boolean | | Gets a value indicating whether access to the BitArray is synchronized (thread-safe). |
Item | | Boolean | | Gets or sets the value of the bit at a specific position in the BitArray. This is the default operator, so can be specified using [] brackets. |
Length | | Integer | | Gets or sets the number of elements in the BitArray. |
|
Microsoft MSDN links | |
|
|