Provides a simple structure that stores Boolean values and small integers in 32 bits of memory.
Assembly: System (in System.dll)
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 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC, Xbox 360, Zune
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.