Provides a simple structure that stores Boolean values and small integers in 32 bits of memory.
Assembly: System (in System.dll)
Thetype exposes the following members.
|CreateMask()||Creates the first mask in a series of masks that can be used to retrieve individual bits in a 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 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 . (Overrides ValueType.Equals(Object).)|
|GetHashCode||Serves as a hash function for the . (Overrides ValueType.GetHashCode().)|
|GetType||Gets the Type of the current instance. (Inherited from Object.)|
|ToString()||Returns a string that represents the current . (Overrides ValueType.ToString().)|
|ToString(BitVector32)||Returns a string that represents the specified .|
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 uses only 32 bits.
A 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 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 .
Some members can be used for a 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 that is set up as sections, and the BitVector32.Item property is the indexer for a that is set up as bit flags. CreateMask creates a series of masks that can be used to access individual bits in a that is set up as bit flags.
Using a mask on a that is set up as sections might cause unexpected results.
The following code example uses a as a collection of bit flags.
The following code example uses a as a collection of sections.
Windows 8.1, Windows Server 2012 R2, 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.