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

Name Description
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.

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.

ReverseEndianness(Byte)

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

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(SByte)

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

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.

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.

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.

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.

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.

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.

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.

Applies to