BitVector32 Structure
Provides a simple structure that stores Boolean values and small integers in 32 bits of memory.
Namespace: System.Collections.Specialized
Assembly: System (in System.dll)
The BitVector32 type exposes the following members.
| Name | Description | |
|---|---|---|
![]() ![]() | BitVector32(BitVector32) | Initializes a new instance of the BitVector32 structure containing the data represented in an existing BitVector32 structure. |
![]() ![]() | BitVector32(Int32) | Initializes a new instance of the BitVector32 structure containing the data represented in an integer. |
| Name | Description | |
|---|---|---|
![]() ![]() | Data | Gets the value of the BitVector32 as an integer. |
![]() ![]() | Item(BitVector32.Section) | Gets or sets the value stored in the specified BitVector32.Section. |
![]() ![]() | Item(Int32) | Gets or sets the state of the bit flag indicated by the specified mask. |
| Name | Description | |
|---|---|---|
![]() ![]() ![]() | CreateMask() | Creates the first mask in a series of masks that can be used to retrieve individual bits in a BitVector32 that is set up as bit flags. |
![]() ![]() ![]() | CreateMask(Int32) | Creates an additional mask following the specified mask in a series of masks that can be used to retrieve individual bits in a BitVector32 that is set up as bit flags. |
![]() ![]() ![]() | CreateSection(Int16) | Creates the first BitVector32.Section in a series of sections that contain small integers. |
![]() ![]() ![]() | CreateSection(Int16, BitVector32.Section) | Creates a new BitVector32.Section following the specified BitVector32.Section in a series of sections that contain small integers. |
![]() ![]() | Equals | Determines whether the specified object is equal to the BitVector32. (Overrides ValueType.Equals(Object).) |
![]() ![]() | GetHashCode | Serves as a hash function for the BitVector32. (Overrides ValueType.GetHashCode().) |
![]() ![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() ![]() | ToString() | Returns a string that represents the current BitVector32. (Overrides ValueType.ToString().) |
![]() ![]() ![]() | ToString(BitVector32) | Returns a string that represents the specified BitVector32. |
BitVector32 is more efficient than BitArray for Boolean values and small integers that are used internally. A BitArray can grow indefinitely as needed, but it has the memory and performance overhead that a class instance requires. In contrast, a BitVector32 uses only 32 bits.
A BitVector32 structure can be set up to contain either sections for small integers or bit flags for Booleans, but not both. A BitVector32.Section is a window into the BitVector32 and is composed of the smallest number of consecutive bits that can contain the maximum value specified in CreateSection. For example, a section with a maximum value of 1 is composed of only one bit, whereas a section with a maximum value of 5 is composed of three bits. You can create a BitVector32.Section with a maximum value of 1 to serve as a Boolean, thereby allowing you to store integers and Booleans in the same BitVector32.
Some members can be used for a BitVector32 that is set up as sections, while other members can be used for one that is set up as bit flags. For example, the BitVector32.Item property is the indexer for a BitVector32 that is set up as sections, and the BitVector32.Item property is the indexer for a BitVector32 that is set up as bit flags. CreateMask creates a series of masks that can be used to access individual bits in a BitVector32 that is set up as bit flags.
Using a mask on a BitVector32 that is set up as sections might cause unexpected results.
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
.gif?cs-save-lang=1&cs-lang=fsharp)
.gif?cs-save-lang=1&cs-lang=fsharp)
.gif?cs-save-lang=1&cs-lang=fsharp)
.gif?cs-save-lang=1&cs-lang=fsharp)