Edit

Share via


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

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

ReadInt128LittleEndian(ReadOnlySpan<Byte>)

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

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

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

ReadIntPtrLittleEndian(ReadOnlySpan<Byte>)

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

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

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

ReadUInt128LittleEndian(ReadOnlySpan<Byte>)

Reads a UInt128 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.

ReadUIntPtrBigEndian(ReadOnlySpan<Byte>)

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

ReadUIntPtrLittleEndian(ReadOnlySpan<Byte>)

Reads a UIntPtr 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(Int128)

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

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)

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

ReverseEndianness(ReadOnlySpan<Int128>, Span<Int128>)

Copies every primitive value from source to destination, reversing each primitive by performing an endianness swap as part of writing each.

ReverseEndianness(ReadOnlySpan<Int16>, Span<Int16>)

Copies every primitive value from source to destination, reversing each primitive by performing an endianness swap as part of writing each.

ReverseEndianness(ReadOnlySpan<Int32>, Span<Int32>)

Copies every primitive value from source to destination, reversing each primitive by performing an endianness swap as part of writing each.

ReverseEndianness(ReadOnlySpan<Int64>, Span<Int64>)

Copies every primitive value from source to destination, reversing each primitive by performing an endianness swap as part of writing each.

ReverseEndianness(ReadOnlySpan<IntPtr>, Span<IntPtr>)

Copies every primitive value from source to destination, reversing each primitive by performing an endianness swap as part of writing each.

ReverseEndianness(ReadOnlySpan<UInt128>, Span<UInt128>)

Copies every primitive value from source to destination, reversing each primitive by performing an endianness swap as part of writing each.

ReverseEndianness(ReadOnlySpan<UInt16>, Span<UInt16>)

Copies every primitive value from source to destination, reversing each primitive by performing an endianness swap as part of writing each.

ReverseEndianness(ReadOnlySpan<UInt32>, Span<UInt32>)

Copies every primitive value from source to destination, reversing each primitive by performing an endianness swap as part of writing each.

ReverseEndianness(ReadOnlySpan<UInt64>, Span<UInt64>)

Copies every primitive value from source to destination, reversing each primitive by performing an endianness swap as part of writing each.

ReverseEndianness(ReadOnlySpan<UIntPtr>, Span<UIntPtr>)

Copies every primitive value from source to destination, reversing each primitive by performing an endianness swap as part of writing each.

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)

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

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)

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

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)

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

TryReadInt128LittleEndian(ReadOnlySpan<Byte>, Int128)

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

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)

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

TryReadIntPtrLittleEndian(ReadOnlySpan<Byte>, IntPtr)

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

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)

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

TryReadUInt128LittleEndian(ReadOnlySpan<Byte>, UInt128)

Reads a UInt128 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.

TryReadUIntPtrBigEndian(ReadOnlySpan<Byte>, UIntPtr)

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

TryReadUIntPtrLittleEndian(ReadOnlySpan<Byte>, UIntPtr)

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

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)

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

TryWriteInt128LittleEndian(Span<Byte>, Int128)

Writes a Int128 into a 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.

TryWriteIntPtrBigEndian(Span<Byte>, IntPtr)

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

TryWriteIntPtrLittleEndian(Span<Byte>, IntPtr)

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

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)

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

TryWriteUInt128LittleEndian(Span<Byte>, UInt128)

Writes a UInt128 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.

TryWriteUIntPtrBigEndian(Span<Byte>, UIntPtr)

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

TryWriteUIntPtrLittleEndian(Span<Byte>, UIntPtr)

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

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)

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

WriteInt128LittleEndian(Span<Byte>, Int128)

Writes a Int128 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.

WriteIntPtrBigEndian(Span<Byte>, IntPtr)

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

WriteIntPtrLittleEndian(Span<Byte>, IntPtr)

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

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)

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

WriteUInt128LittleEndian(Span<Byte>, UInt128)

Writes a UInt128 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.

WriteUIntPtrBigEndian(Span<Byte>, UIntPtr)

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

WriteUIntPtrLittleEndian(Span<Byte>, UIntPtr)

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

Applies to