BinaryPrimitives Class

Definition

Reads bytes as primitives with specific endianness.

public ref class BinaryPrimitives abstract sealed
public static class BinaryPrimitives
type BinaryPrimitives = class
Public Class BinaryPrimitives
Inheritance
BinaryPrimitives

Remarks

Use these helpers when you need to read specific endianness.

Methods

ReadDoubleBigEndian(ReadOnlySpan<Byte>)

Reads a Double from the beginning of a read-only span of bytes, as big endian.

ReadDoubleLittleEndian(ReadOnlySpan<Byte>)

Reads a Double from the beginning of a read-only span of bytes, as little endian.

ReadHalfBigEndian(ReadOnlySpan<Byte>)

Reads a Half from the beginning of a read-only span of bytes, as big endian.

ReadHalfLittleEndian(ReadOnlySpan<Byte>)

Reads a Half from the beginning of a read-only span of bytes, as little endian.

ReadInt128BigEndian(ReadOnlySpan<Byte>)
ReadInt128LittleEndian(ReadOnlySpan<Byte>)
ReadInt16BigEndian(ReadOnlySpan<Byte>)

Reads an Int16 from the beginning of a read-only span of bytes, as big endian.

ReadInt16LittleEndian(ReadOnlySpan<Byte>)

Reads an Int16 from the beginning of a read-only span of bytes, as little endian.

ReadInt32BigEndian(ReadOnlySpan<Byte>)

Reads an Int32 from the beginning of a read-only span of bytes, as big endian.

ReadInt32LittleEndian(ReadOnlySpan<Byte>)

Reads an Int32 from the beginning of a read-only span of bytes, as little endian.

ReadInt64BigEndian(ReadOnlySpan<Byte>)

Reads an Int64 from the beginning of a read-only span of bytes, as big endian.

ReadInt64LittleEndian(ReadOnlySpan<Byte>)

Reads an Int64 from the beginning of a read-only span of bytes, as little endian.

ReadIntPtrBigEndian(ReadOnlySpan<Byte>)
ReadIntPtrLittleEndian(ReadOnlySpan<Byte>)
ReadSingleBigEndian(ReadOnlySpan<Byte>)

Reads a Single from the beginning of a read-only span of bytes, as big endian.

ReadSingleLittleEndian(ReadOnlySpan<Byte>)

Reads a Single from the beginning of a read-only span of bytes, as little endian.

ReadUInt128BigEndian(ReadOnlySpan<Byte>)
ReadUInt128LittleEndian(ReadOnlySpan<Byte>)
ReadUInt16BigEndian(ReadOnlySpan<Byte>)

Reads a UInt16 from the beginning of a read-only span of bytes, as big endian.

ReadUInt16LittleEndian(ReadOnlySpan<Byte>)

Reads a UInt16 from the beginning of a read-only span of bytes, as little endian.

ReadUInt32BigEndian(ReadOnlySpan<Byte>)

Reads a UInt32 from the beginning of a read-only span of bytes, as big endian.

ReadUInt32LittleEndian(ReadOnlySpan<Byte>)

Reads a UInt32 from the beginning of a read-only span of bytes, as little endian.

ReadUInt64BigEndian(ReadOnlySpan<Byte>)

Reads a UInt64 from the beginning of a read-only span of bytes, as big endian.

ReadUInt64LittleEndian(ReadOnlySpan<Byte>)

Reads a UInt64 from the beginning of a read-only span of bytes, as little endian.

ReadUIntPtrBigEndian(ReadOnlySpan<Byte>)
ReadUIntPtrLittleEndian(ReadOnlySpan<Byte>)
ReverseEndianness(Byte)

Reverses a primitive value by performing an endianness swap of the specified Byte value, which effectively does nothing for a Byte.

ReverseEndianness(Int128)
ReverseEndianness(Int16)

Reverses a primitive value by performing an endianness swap of the specified Int16 value.

ReverseEndianness(Int32)

Reverses a primitive value by performing an endianness swap of the specified Int32 value.

ReverseEndianness(Int64)

Reverses a primitive value by performing an endianness swap of the specified Int64 value.

ReverseEndianness(IntPtr)
ReverseEndianness(ReadOnlySpan<Int128>, Span<Int128>)
ReverseEndianness(ReadOnlySpan<Int16>, Span<Int16>)
ReverseEndianness(ReadOnlySpan<Int32>, Span<Int32>)
ReverseEndianness(ReadOnlySpan<Int64>, Span<Int64>)
ReverseEndianness(ReadOnlySpan<IntPtr>, Span<IntPtr>)
ReverseEndianness(ReadOnlySpan<UInt128>, Span<UInt128>)
ReverseEndianness(ReadOnlySpan<UInt16>, Span<UInt16>)
ReverseEndianness(ReadOnlySpan<UInt32>, Span<UInt32>)
ReverseEndianness(ReadOnlySpan<UInt64>, Span<UInt64>)
ReverseEndianness(ReadOnlySpan<UIntPtr>, Span<UIntPtr>)
ReverseEndianness(SByte)

Reverses a primitive value by performing an endianness swap of the specified SByte value, which effectively does nothing for an SByte.

ReverseEndianness(UInt128)
ReverseEndianness(UInt16)

Reverses a primitive value by performing an endianness swap of the specified UInt16 value.

ReverseEndianness(UInt32)

Reverses a primitive value by performing an endianness swap of the specified UInt32 value.

ReverseEndianness(UInt64)

Reverses a primitive value by performing an endianness swap of the specified UInt64 value.

ReverseEndianness(UIntPtr)
TryReadDoubleBigEndian(ReadOnlySpan<Byte>, Double)

Reads a Double from the beginning of a read-only span of bytes, as big endian.

TryReadDoubleLittleEndian(ReadOnlySpan<Byte>, Double)

Reads a Double from the beginning of a read-only span of bytes, as little endian.

TryReadHalfBigEndian(ReadOnlySpan<Byte>, Half)

Reads a Half from the beginning of a read-only span of bytes, as big endian.

TryReadHalfLittleEndian(ReadOnlySpan<Byte>, Half)

Reads a Half from the beginning of a read-only span of bytes, as little endian.

TryReadInt128BigEndian(ReadOnlySpan<Byte>, Int128)
TryReadInt128LittleEndian(ReadOnlySpan<Byte>, Int128)
TryReadInt16BigEndian(ReadOnlySpan<Byte>, Int16)

Reads an Int16 from the beginning of a read-only span of bytes, as big endian.

TryReadInt16LittleEndian(ReadOnlySpan<Byte>, Int16)

Reads an Int16 from the beginning of a read-only span of bytes, as little endian.

TryReadInt32BigEndian(ReadOnlySpan<Byte>, Int32)

Reads an Int32 from the beginning of a read-only span of bytes, as big endian.

TryReadInt32LittleEndian(ReadOnlySpan<Byte>, Int32)

Reads an Int32 from the beginning of a read-only span of bytes, as little endian.

TryReadInt64BigEndian(ReadOnlySpan<Byte>, Int64)

Reads an Int64 from the beginning of a read-only span of bytes, as big endian.

TryReadInt64LittleEndian(ReadOnlySpan<Byte>, Int64)

Reads an Int64 from the beginning of a read-only span of bytes, as little endian.

TryReadIntPtrBigEndian(ReadOnlySpan<Byte>, IntPtr)
TryReadIntPtrLittleEndian(ReadOnlySpan<Byte>, IntPtr)
TryReadSingleBigEndian(ReadOnlySpan<Byte>, Single)

Reads a Single from the beginning of a read-only span of bytes, as big endian.

TryReadSingleLittleEndian(ReadOnlySpan<Byte>, Single)

Reads a Single from the beginning of a read-only span of bytes, as little endian.

TryReadUInt128BigEndian(ReadOnlySpan<Byte>, UInt128)
TryReadUInt128LittleEndian(ReadOnlySpan<Byte>, UInt128)
TryReadUInt16BigEndian(ReadOnlySpan<Byte>, UInt16)

Reads a UInt16 from the beginning of a read-only span of bytes, as big endian.

TryReadUInt16LittleEndian(ReadOnlySpan<Byte>, UInt16)

Reads a UInt16 from the beginning of a read-only span of bytes, as little endian.

TryReadUInt32BigEndian(ReadOnlySpan<Byte>, UInt32)

Reads a UInt32 from the beginning of a read-only span of bytes, as big endian.

TryReadUInt32LittleEndian(ReadOnlySpan<Byte>, UInt32)

Reads a UInt32 from the beginning of a read-only span of bytes, as little endian.

TryReadUInt64BigEndian(ReadOnlySpan<Byte>, UInt64)

Reads a UInt64 from the beginning of a read-only span of bytes, as big endian.

TryReadUInt64LittleEndian(ReadOnlySpan<Byte>, UInt64)

Reads a UInt64 from the beginning of a read-only span of bytes, as little endian.

TryReadUIntPtrBigEndian(ReadOnlySpan<Byte>, UIntPtr)
TryReadUIntPtrLittleEndian(ReadOnlySpan<Byte>, UIntPtr)
TryWriteDoubleBigEndian(Span<Byte>, Double)

Writes a Double into a span of bytes, as big endian.

TryWriteDoubleLittleEndian(Span<Byte>, Double)

Writes a Double into a span of bytes, as little endian.

TryWriteHalfBigEndian(Span<Byte>, Half)

Writes a Half into a span of bytes, as big endian.

TryWriteHalfLittleEndian(Span<Byte>, Half)

Writes a Half into a span of bytes, as little endian.

TryWriteInt128BigEndian(Span<Byte>, Int128)
TryWriteInt128LittleEndian(Span<Byte>, Int128)
TryWriteInt16BigEndian(Span<Byte>, Int16)

Writes an Int16 into a span of bytes, as big endian.

TryWriteInt16LittleEndian(Span<Byte>, Int16)

Writes an Int16 into a span of bytes, as little endian.

TryWriteInt32BigEndian(Span<Byte>, Int32)

Writes an Int32 into a span of bytes, as big endian.

TryWriteInt32LittleEndian(Span<Byte>, Int32)

Writes an Int32 into a span of bytes, as little endian.

TryWriteInt64BigEndian(Span<Byte>, Int64)

Writes an Int64 into a span of bytes, as big endian.

TryWriteInt64LittleEndian(Span<Byte>, Int64)

Writes an Int64 into a span of bytes, as little endian.

TryWriteIntPtrBigEndian(Span<Byte>, IntPtr)
TryWriteIntPtrLittleEndian(Span<Byte>, IntPtr)
TryWriteSingleBigEndian(Span<Byte>, Single)

Writes a Single into a span of bytes, as big endian.

TryWriteSingleLittleEndian(Span<Byte>, Single)

Writes a Single into a span of bytes, as little endian.

TryWriteUInt128BigEndian(Span<Byte>, UInt128)
TryWriteUInt128LittleEndian(Span<Byte>, UInt128)
TryWriteUInt16BigEndian(Span<Byte>, UInt16)

Writes a UInt16 into a span of bytes, as big endian.

TryWriteUInt16LittleEndian(Span<Byte>, UInt16)

Writes a UInt16 into a span of bytes, as little endian.

TryWriteUInt32BigEndian(Span<Byte>, UInt32)

Writes a UInt32 into a span of bytes, as big endian.

TryWriteUInt32LittleEndian(Span<Byte>, UInt32)

Writes a UInt32 into a span of bytes, as little endian.

TryWriteUInt64BigEndian(Span<Byte>, UInt64)

Writes a UInt64 into a span of bytes, as big endian.

TryWriteUInt64LittleEndian(Span<Byte>, UInt64)

Writes a UInt64 into a span of bytes, as little endian.

TryWriteUIntPtrBigEndian(Span<Byte>, UIntPtr)
TryWriteUIntPtrLittleEndian(Span<Byte>, UIntPtr)
WriteDoubleBigEndian(Span<Byte>, Double)

Writes a Double into a span of bytes, as big endian.

WriteDoubleLittleEndian(Span<Byte>, Double)

Writes a Double into a span of bytes, as little endian.

WriteHalfBigEndian(Span<Byte>, Half)

Writes a Half into a span of bytes, as big endian.

WriteHalfLittleEndian(Span<Byte>, Half)

Writes a Half into a span of bytes, as little endian.

WriteInt128BigEndian(Span<Byte>, Int128)
WriteInt128LittleEndian(Span<Byte>, Int128)
WriteInt16BigEndian(Span<Byte>, Int16)

Writes an Int16 into a span of bytes, as big endian.

WriteInt16LittleEndian(Span<Byte>, Int16)

Writes an Int16 into a span of bytes, as little endian.

WriteInt32BigEndian(Span<Byte>, Int32)

Writes an Int32 into a span of bytes, as big endian.

WriteInt32LittleEndian(Span<Byte>, Int32)

Writes an Int32 into a span of bytes, as little endian.

WriteInt64BigEndian(Span<Byte>, Int64)

Writes an Int64 into a span of bytes, as big endian.

WriteInt64LittleEndian(Span<Byte>, Int64)

Writes an Int64 into a span of bytes, as little endian.

WriteIntPtrBigEndian(Span<Byte>, IntPtr)
WriteIntPtrLittleEndian(Span<Byte>, IntPtr)
WriteSingleBigEndian(Span<Byte>, Single)

Writes a Single into a span of bytes, as big endian.

WriteSingleLittleEndian(Span<Byte>, Single)

Writes a Single into a span of bytes, as little endian.

WriteUInt128BigEndian(Span<Byte>, UInt128)
WriteUInt128LittleEndian(Span<Byte>, UInt128)
WriteUInt16BigEndian(Span<Byte>, UInt16)

Writes a UInt16 into a span of bytes, as big endian.

WriteUInt16LittleEndian(Span<Byte>, UInt16)

Writes a UInt16 into a span of bytes, as little endian.

WriteUInt32BigEndian(Span<Byte>, UInt32)

Writes a UInt32 into a span of bytes, as big endian.

WriteUInt32LittleEndian(Span<Byte>, UInt32)

Writes a UInt32 into a span of bytes, as little endian.

WriteUInt64BigEndian(Span<Byte>, UInt64)

Writes a UInt64 into a span of bytes, as big endian.

WriteUInt64LittleEndian(Span<Byte>, UInt64)

Writes a UInt64 into a span of bytes, as little endian.

WriteUIntPtrBigEndian(Span<Byte>, UIntPtr)
WriteUIntPtrLittleEndian(Span<Byte>, UIntPtr)

Applies to