CollectionsMarshal.AsBytes(BitArray) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
public:
static Span<System::Byte> AsBytes(System::Collections::BitArray ^ array);
public static Span<byte> AsBytes(System.Collections.BitArray? array);
static member AsBytes : System.Collections.BitArray -> Span<byte>
Public Shared Function AsBytes (array As BitArray) As Span(Of Byte)
Parameters
Returns
Remarks
The BitArray may have more capacity than is required to store the number of bits represented by Length.
The returned span's Length will be the smallest number of bytes capable of representing that length. If the BitArray's length is not evenly divisible by 8, the last byte of the span may contain extraneous bits that do not represent elements in the BitArray. These can be ignored.
The length of the BitArray should not be changed while the resulting Span<T> is in use. After such a change, the span may no longer refer to the BitArray's backing storage.