Mallard
Search Results for

    Show / Hide Table of Contents

    Struct DuckDbBitString

    The representation of a bit string in a DuckDB vector.

    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    ValueType.ToString()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    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 Source

    Length

    The number of bits contained in the bit string.

    Declaration
    public int Length { get; }
    Property Value
    Type Description
    int

    Methods

    | Edit this page View Source

    GetBit(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.

    | Edit this page View Source

    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 i (corresponding to source position i + offset) is (destination[i/8] & (1 << (i%8))) != 0. Unused bits in the last byte of the output are always set to zero. The value of the bytes in the buffer beyond the last byte needed for the output will be indeterminate.

    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 destination.

    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.

    | Edit this page View Source

    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.

    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX