Struct DuckDbBitString
The representation of a bit string in a DuckDB vector.
Inherited Members
Namespace: Mallard.Types
Assembly: Mallard.dll
Syntax
public readonly ref struct DuckDbBitString
Remarks
This structure is only used for reading, not for writing/sending values to DuckDB.
Properties
| Edit this page View SourceLength
The number of bits contained in the bit string.
Declaration
public int Length { get; }
Property Value
Type | Description |
---|---|
int |
Methods
| Edit this page View SourceGetBit(int)
Get the boolean value at the given bit position.
Declaration
public bool GetBit(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The zero-based index of the bit position. Bit 0 refers to the left-most bit when the bit string is written in DuckDB's syntax. |
Returns
Type | Description |
---|---|
bool | True if the bit is set; false if not. |
Exceptions
Type | Condition |
---|---|
IndexOutOfRangeException | The index is out of range for the bit string. |
GetSegment(Span<byte>, int, int)
Copy out consecutive bits in the bit string.
Declaration
public int GetSegment(Span<byte> destination, int offset, int length)
Parameters
Type | Name | Description |
---|---|---|
Span<byte> | destination | Buffer to extract the bits into. The bits will be presented in the same little-endian encoding
read by BitArray(byte[]): the value of the bit at output position
|
int | offset | The zero-based index of the position in this bit string to start extracting bits. Must not be negative. |
int | length | The number of bits to extract. Must not be negative. |
Returns
Type | Description |
---|---|
int | Number of bytes written to the beginning of |
Remarks
This method is an efficient alternative to converting the data to BitArray.
Exceptions
Type | Condition |
---|---|
IndexOutOfRangeException | The requested range of bits to extract is out of range for this bit string. |
ToBitArray()
Convert to a .NET BitArray instance.
Declaration
public BitArray ToBitArray()
Returns
Type | Description |
---|---|
BitArray | BitArray with the same bits in the same (indexing) order. |