Couchbase .NET SDK | 3.9.0
Search Results for

    Show / Hide Table of Contents

    Class ByteConverter

    Converts types and arrays before being sent or after being received across the network. Unless an overload is called with useNbo = false, Network Byte Order will be used in the conversion.

    Inheritance
    object
    ByteConverter
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Couchbase.Core.IO.Converters
    Assembly: Couchbase.NetClient.dll
    Syntax
    public static class ByteConverter

    Methods

    | Edit this page View Source

    FromInt16(short, Span<byte>)

    Writes a short to a buffer, using network byte order.

    Declaration
    public static void FromInt16(short value, Span<byte> buffer)
    Parameters
    Type Name Description
    short value

    The value.

    Span<byte> buffer

    The buffer.

    | Edit this page View Source

    FromInt16(short, Span<byte>, bool)

    Writes a short to a buffer.

    Declaration
    public static void FromInt16(short value, Span<byte> buffer, bool useNbo)
    Parameters
    Type Name Description
    short value

    The value.

    Span<byte> buffer

    The buffer.

    bool useNbo

    If true will make most significant byte first.

    | Edit this page View Source

    FromInt32(int, Span<byte>)

    Writes a int to a buffer, using network byte order.

    Declaration
    public static void FromInt32(int value, Span<byte> buffer)
    Parameters
    Type Name Description
    int value

    The value.

    Span<byte> buffer

    The buffer.

    | Edit this page View Source

    FromInt32(int, Span<byte>, bool)

    Writes a int to a buffer.

    Declaration
    public static void FromInt32(int value, Span<byte> buffer, bool useNbo)
    Parameters
    Type Name Description
    int value

    The value.

    Span<byte> buffer

    The buffer.

    bool useNbo

    If true will make most significant byte first.

    | Edit this page View Source

    FromInt64(long, Span<byte>)

    Writes a long to a buffer, using network byte order.

    Declaration
    public static void FromInt64(long value, Span<byte> buffer)
    Parameters
    Type Name Description
    long value

    The value.

    Span<byte> buffer

    The buffer.

    | Edit this page View Source

    FromInt64(long, Span<byte>, bool)

    Writes a long to a buffer.

    Declaration
    public static void FromInt64(long value, Span<byte> buffer, bool useNbo)
    Parameters
    Type Name Description
    long value

    The value.

    Span<byte> buffer

    The buffer.

    bool useNbo

    If true will make most significant byte first.

    | Edit this page View Source

    FromString(string, Span<byte>)

    Writes a string to a buffer.

    Declaration
    public static int FromString(string value, Span<byte> buffer)
    Parameters
    Type Name Description
    string value

    The value.

    Span<byte> buffer

    The buffer.

    Returns
    Type Description
    int

    Number of bytes written to the buffer.

    | Edit this page View Source

    FromUInt16(ushort, Span<byte>)

    Writes a ushort to a buffer, using network byte order.

    Declaration
    public static void FromUInt16(ushort value, Span<byte> buffer)
    Parameters
    Type Name Description
    ushort value

    The value.

    Span<byte> buffer

    The buffer.

    | Edit this page View Source

    FromUInt16(ushort, Span<byte>, bool)

    Writes a ushort to a buffer.

    Declaration
    public static void FromUInt16(ushort value, Span<byte> buffer, bool useNbo)
    Parameters
    Type Name Description
    ushort value

    The value.

    Span<byte> buffer

    The buffer.

    bool useNbo

    If true will make most significant byte first.

    | Edit this page View Source

    FromUInt32(uint, Span<byte>)

    Writes a uint to a buffer, using network byte order.

    Declaration
    public static void FromUInt32(uint value, Span<byte> buffer)
    Parameters
    Type Name Description
    uint value

    The value.

    Span<byte> buffer

    The buffer.

    | Edit this page View Source

    FromUInt32(uint, Span<byte>, bool)

    Writes a uint to a buffer.

    Declaration
    public static void FromUInt32(uint value, Span<byte> buffer, bool useNbo)
    Parameters
    Type Name Description
    uint value

    The value.

    Span<byte> buffer

    The buffer.

    bool useNbo

    If true will make most significant byte first.

    | Edit this page View Source

    FromUInt64(ulong, Span<byte>)

    Writes a ulong to a buffer, using network byte order.

    Declaration
    public static void FromUInt64(ulong value, Span<byte> buffer)
    Parameters
    Type Name Description
    ulong value

    The value.

    Span<byte> buffer

    The buffer.

    | Edit this page View Source

    FromUInt64(ulong, Span<byte>, bool)

    Writes a ulong to a buffer.

    Declaration
    public static void FromUInt64(ulong value, Span<byte> buffer, bool useNbo)
    Parameters
    Type Name Description
    ulong value

    The value.

    Span<byte> buffer

    The buffer.

    bool useNbo

    If true will make most significant byte first.

    | Edit this page View Source

    GetStringByteCount(string)

    Gets the number of bytes required to convert a string.

    Declaration
    public static int GetStringByteCount(string value)
    Parameters
    Type Name Description
    string value

    The value.

    Returns
    Type Description
    int

    The number of bytes required to convert the string.

    | Edit this page View Source

    ToBoolean(ReadOnlySpan<byte>, bool)

    Reads a bool from a buffer.

    Declaration
    public static bool ToBoolean(ReadOnlySpan<byte> buffer, bool useNbo)
    Parameters
    Type Name Description
    ReadOnlySpan<byte> buffer

    The buffer.

    bool useNbo

    if set to true [use nbo].

    Returns
    Type Description
    bool
    | Edit this page View Source

    ToDateTime(ReadOnlySpan<byte>, bool)

    Reads a DateTime from a buffer.

    Declaration
    public static DateTime ToDateTime(ReadOnlySpan<byte> buffer, bool useNbo)
    Parameters
    Type Name Description
    ReadOnlySpan<byte> buffer

    The buffer.

    bool useNbo

    if set to true [use nbo].

    Returns
    Type Description
    DateTime
    | Edit this page View Source

    ToDouble(ReadOnlySpan<byte>, bool)

    To the double.

    Declaration
    public static double ToDouble(ReadOnlySpan<byte> buffer, bool useNbo)
    Parameters
    Type Name Description
    ReadOnlySpan<byte> buffer

    The buffer.

    bool useNbo

    if set to true [use nbo].

    Returns
    Type Description
    double
    | Edit this page View Source

    ToInt16(ReadOnlySpan<byte>)

    Reads a short from a buffer, using network byte order.

    Declaration
    public static short ToInt16(ReadOnlySpan<byte> buffer)
    Parameters
    Type Name Description
    ReadOnlySpan<byte> buffer

    The buffer.

    Returns
    Type Description
    short
    | Edit this page View Source

    ToInt16(ReadOnlySpan<byte>, bool)

    Reads a short from a buffer starting.

    Declaration
    public static short ToInt16(ReadOnlySpan<byte> buffer, bool useNbo)
    Parameters
    Type Name Description
    ReadOnlySpan<byte> buffer

    The buffer.

    bool useNbo

    If true will make most significant byte first.

    Returns
    Type Description
    short
    | Edit this page View Source

    ToInt32(ReadOnlySpan<byte>)

    Reads a int from a buffer, using network byte order.

    Declaration
    public static int ToInt32(ReadOnlySpan<byte> buffer)
    Parameters
    Type Name Description
    ReadOnlySpan<byte> buffer

    The buffer.

    Returns
    Type Description
    int
    | Edit this page View Source

    ToInt32(ReadOnlySpan<byte>, bool)

    Reads a int from a buffer.

    Declaration
    public static int ToInt32(ReadOnlySpan<byte> buffer, bool useNbo)
    Parameters
    Type Name Description
    ReadOnlySpan<byte> buffer

    The buffer.

    bool useNbo

    If true will make most significant byte first.

    Returns
    Type Description
    int
    | Edit this page View Source

    ToInt64(ReadOnlySpan<byte>)

    Reads a long from a buffer, using network byte order.

    Declaration
    public static long ToInt64(ReadOnlySpan<byte> buffer)
    Parameters
    Type Name Description
    ReadOnlySpan<byte> buffer

    The buffer.

    Returns
    Type Description
    long
    | Edit this page View Source

    ToInt64(ReadOnlySpan<byte>, bool)

    Reads a long from a buffer.

    Declaration
    public static long ToInt64(ReadOnlySpan<byte> buffer, bool useNbo)
    Parameters
    Type Name Description
    ReadOnlySpan<byte> buffer

    The buffer.

    bool useNbo

    If true will make most significant byte first.

    Returns
    Type Description
    long
    | Edit this page View Source

    ToSingle(ReadOnlySpan<byte>, bool)

    Reads a float from a buffer.

    Declaration
    public static float ToSingle(ReadOnlySpan<byte> buffer, bool useNbo)
    Parameters
    Type Name Description
    ReadOnlySpan<byte> buffer

    The buffer.

    bool useNbo

    if set to true [use nbo].

    Returns
    Type Description
    float
    | Edit this page View Source

    ToString(ReadOnlySpan<byte>)

    Returns a string from the buffer.

    Declaration
    public static string ToString(ReadOnlySpan<byte> buffer)
    Parameters
    Type Name Description
    ReadOnlySpan<byte> buffer

    The buffer.

    Returns
    Type Description
    string

    A string that represents this instance.

    | Edit this page View Source

    ToUInt16(ReadOnlySpan<byte>)

    Reads a ushort from a buffer, using network byte order.

    Declaration
    public static ushort ToUInt16(ReadOnlySpan<byte> buffer)
    Parameters
    Type Name Description
    ReadOnlySpan<byte> buffer

    The buffer.

    Returns
    Type Description
    ushort
    | Edit this page View Source

    ToUInt16(ReadOnlySpan<byte>, bool)

    Reads a ushort from a buffer.

    Declaration
    public static ushort ToUInt16(ReadOnlySpan<byte> buffer, bool useNbo)
    Parameters
    Type Name Description
    ReadOnlySpan<byte> buffer

    The buffer.

    bool useNbo

    If true will make most significant byte first.

    Returns
    Type Description
    ushort
    | Edit this page View Source

    ToUInt32(ReadOnlySpan<byte>)

    Reads a uint from a buffer, using network byte order.

    Declaration
    public static uint ToUInt32(ReadOnlySpan<byte> buffer)
    Parameters
    Type Name Description
    ReadOnlySpan<byte> buffer

    The buffer.

    Returns
    Type Description
    uint
    | Edit this page View Source

    ToUInt32(ReadOnlySpan<byte>, bool)

    Reads a uint from a buffer.

    Declaration
    public static uint ToUInt32(ReadOnlySpan<byte> buffer, bool useNbo)
    Parameters
    Type Name Description
    ReadOnlySpan<byte> buffer

    The buffer.

    bool useNbo

    If true will make most significant byte first.

    Returns
    Type Description
    uint
    | Edit this page View Source

    ToUInt64(ReadOnlySpan<byte>)

    Reads a ulong from a buffer, using network byte order.

    Declaration
    public static ulong ToUInt64(ReadOnlySpan<byte> buffer)
    Parameters
    Type Name Description
    ReadOnlySpan<byte> buffer

    The buffer.

    Returns
    Type Description
    ulong
    | Edit this page View Source

    ToUInt64(ReadOnlySpan<byte>, bool)

    Reads a ulong from a buffer.

    Declaration
    public static ulong ToUInt64(ReadOnlySpan<byte> buffer, bool useNbo)
    Parameters
    Type Name Description
    ReadOnlySpan<byte> buffer

    The buffer.

    bool useNbo

    If true will make most significant byte first.

    Returns
    Type Description
    ulong
    • Edit this page
    • View Source
    In this article
    Back to top © 2026 Couchbase, Inc.