Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​Buffers.​Binary.​BinaryPrimitives
Assembly: System.Memory
Inheritance: object → BinaryPrimitives
Reads bytes as primitives with specific endianness.
Methods
public static
double
ReadDoubleBigEndian​(ReadOnlySpan<​byte> source)
Reads a <see cref="T:System.Double" /> from the beginning of a read-only span of bytes, as big endian.
Returns The big endian value.
source
The read-only span to read.
public static
double
ReadDoubleLittleEndian​(ReadOnlySpan<​byte> source)
Reads a <see cref="T:System.Double" /> from the beginning of a read-only span of bytes, as little endian.
Returns The little endian value.
source
The read-only span to read.
public static
Half
ReadHalfBigEndian​(ReadOnlySpan<​byte> source)
Reads a <see cref="T:System.Half" /> from the beginning of a read-only span of bytes, as big endian.
Returns The big endian value.
source
The read-only span to read.
public static
Half
ReadHalfLittleEndian​(ReadOnlySpan<​byte> source)
Reads a <see cref="T:System.Half" /> from the beginning of a read-only span of bytes, as little endian.
Returns The little endian value.
source
The read-only span to read.
public static
short
ReadInt16BigEndian​(ReadOnlySpan<​byte> source)
Reads an <see cref="T:System.Int16" /> from the beginning of a read-only span of bytes, as big endian.
Returns The big endian value.
source
The read-only span to read.
public static
short
ReadInt16LittleEndian​(ReadOnlySpan<​byte> source)
Reads an <see cref="T:System.Int16" /> from the beginning of a read-only span of bytes, as little endian.
Returns The little endian value.
source
The read-only span to read.
public static
int
ReadInt32BigEndian​(ReadOnlySpan<​byte> source)
Reads an <see cref="T:System.Int32" /> from the beginning of a read-only span of bytes, as big endian.
Returns The big endian value.
source
The read-only span to read.
public static
int
ReadInt32LittleEndian​(ReadOnlySpan<​byte> source)
Reads an <see cref="T:System.Int32" /> from the beginning of a read-only span of bytes, as little endian.
Returns The little endian value.
source
The read-only span to read.
public static
long
ReadInt64BigEndian​(ReadOnlySpan<​byte> source)
Reads an <see cref="T:System.Int64" /> from the beginning of a read-only span of bytes, as big endian.
Returns The big endian value.
source
The read-only span to read.
public static
long
ReadInt64LittleEndian​(ReadOnlySpan<​byte> source)
Reads an <see cref="T:System.Int64" /> from the beginning of a read-only span of bytes, as little endian.
Returns The little endian value.
source
The read-only span to read.
public static
Int128
ReadInt128BigEndian​(ReadOnlySpan<​byte> source)
Reads a <see cref="T:System.Int128" /> from the beginning of a read-only span of bytes, as big endian.
Returns The big endian value.
source
The read-only span to read.
public static
Int128
ReadInt128LittleEndian​(ReadOnlySpan<​byte> source)
Reads a <see cref="T:System.Int128" /> from the beginning of a read-only span of bytes, as little endian.
Returns The little endian value.
source
The read-only span to read.
public static
nint
ReadIntPtrBigEndian​(ReadOnlySpan<​byte> source)
Reads a <see cref="T:System.IntPtr" /> from the beginning of a read-only span of bytes, as big endian.
Returns The big endian value.
source
The read-only span to read.
public static
nint
ReadIntPtrLittleEndian​(ReadOnlySpan<​byte> source)
Reads a <see cref="T:System.IntPtr" /> from the beginning of a read-only span of bytes, as little endian.
Returns The little endian value.
source
The read-only span to read.
public static
Single
ReadSingleBigEndian​(ReadOnlySpan<​byte> source)
Reads a <see cref="T:System.Single" /> from the beginning of a read-only span of bytes, as big endian.
Returns The big endian value.
source
The read-only span to read.
public static
Single
ReadSingleLittleEndian​(ReadOnlySpan<​byte> source)
Reads a <see cref="T:System.Single" /> from the beginning of a read-only span of bytes, as little endian.
Returns The little endian value.
source
The read-only span to read.
public static
ushort
ReadUInt16BigEndian​(ReadOnlySpan<​byte> source)
Reads a <see cref="T:System.UInt16" /> from the beginning of a read-only span of bytes, as big endian.
Returns The big endian value.
source
The read-only span to read.
public static
ushort
ReadUInt16LittleEndian​(ReadOnlySpan<​byte> source)
Reads a <see cref="T:System.UInt16" /> from the beginning of a read-only span of bytes, as little endian.
Returns The little endian value.
source
The read-only span to read.
public static
uint
ReadUInt32BigEndian​(ReadOnlySpan<​byte> source)
Reads a <see cref="T:System.UInt32" /> from the beginning of a read-only span of bytes, as big endian.
Returns The big endian value.
source
The read-only span to read.
public static
uint
ReadUInt32LittleEndian​(ReadOnlySpan<​byte> source)
Reads a <see cref="T:System.UInt32" /> from the beginning of a read-only span of bytes, as little endian.
Returns The little endian value.
source
The read-only span of bytes to read.
public static
ulong
ReadUInt64BigEndian​(ReadOnlySpan<​byte> source)
Reads a <see cref="T:System.UInt64" /> from the beginning of a read-only span of bytes, as big endian.
Returns The big endian value.
source
The read-only span of bytes to read.
public static
ulong
ReadUInt64LittleEndian​(ReadOnlySpan<​byte> source)
Reads a <see cref="T:System.UInt64" /> from the beginning of a read-only span of bytes, as little endian.
Returns The little endian value.
source
The read-only span of bytes to read.
public static
UInt128
ReadUInt128BigEndian​(ReadOnlySpan<​byte> source)
Reads a <see cref="T:System.UInt128" /> from the beginning of a read-only span of bytes, as big endian.
Returns The big endian value.
source
The read-only span to read.
public static
UInt128
ReadUInt128LittleEndian​(ReadOnlySpan<​byte> source)
Reads a <see cref="T:System.UInt128" /> from the beginning of a read-only span of bytes, as little endian.
Returns The little endian value.
source
The read-only span to read.
public static
UIntPtr
ReadUIntPtrBigEndian​(ReadOnlySpan<​byte> source)
Reads a <see cref="T:System.UIntPtr" /> from the beginning of a read-only span of bytes, as big endian.
Returns The big endian value.
source
The read-only span to read.
public static
UIntPtr
ReadUIntPtrLittleEndian​(ReadOnlySpan<​byte> source)
Reads a <see cref="T:System.UIntPtr" /> from the beginning of a read-only span of bytes, as little endian.
Returns The little endian value.
source
The read-only span to read.
public static
byte
ReverseEndianness​(byte value)
Reverses a primitive value by performing an endianness swap of the specified <see cref="T:System.Byte" /> value, which effectively does nothing for a <see cref="T:System.Byte" /> .
Returns The passed-in value, unmodified.
value
The value to reverse.
public static
short
ReverseEndianness​(short value)
Reverses a primitive value by performing an endianness swap of the specified <see cref="T:System.Int16" /> value.
Returns The reversed value.
value
The value to reverse.
public static
int
ReverseEndianness​(int value)
Reverses a primitive value by performing an endianness swap of the specified <see cref="T:System.Int32" /> value.
Returns The reversed value.
value
The value to reverse.
public static
long
ReverseEndianness​(long value)
Reverses a primitive value by performing an endianness swap of the specified <see cref="T:System.Int64" /> value.
Returns The reversed value.
value
The value to reverse.
public static
sbyte
ReverseEndianness​(sbyte value)
Reverses a primitive value by performing an endianness swap of the specified <see cref="T:System.SByte" /> value, which effectively does nothing for an <see cref="T:System.SByte" /> .
Returns The passed-in value, unmodified.
value
The value to reverse.
public static
ushort
ReverseEndianness​(ushort value)
Reverses a primitive value by performing an endianness swap of the specified <see cref="T:System.UInt16" /> value.
Returns The reversed value.
value
The value to reverse.
public static
uint
ReverseEndianness​(uint value)
Reverses a primitive value by performing an endianness swap of the specified <see cref="T:System.UInt32" /> value.
Returns The reversed value.
value
The value to reverse.
public static
ulong
ReverseEndianness​(ulong value)
Reverses a primitive value by performing an endianness swap of the specified <see cref="T:System.UInt64" /> value.
Returns The reversed value.
value
The value to reverse.
public static
nint
ReverseEndianness​(nint value)
Reverses a primitive value by performing an endianness swap of the specified <see cref="T:System.IntPtr" /> value.
Returns The reversed value.
value
The value to reverse.
public static
UIntPtr
ReverseEndianness​(UIntPtr value)
Reverses a primitive value by performing an endianness swap of the specified <see cref="T:System.UIntPtr" /> value.
Returns The reversed value.
value
The value to reverse.
public static
Int128
ReverseEndianness​(Int128 value)
Reverses a primitive value by performing an endianness swap of the specified <see cref="T:System.Int128" /> value.
Returns The reversed value.
value
The value to reverse.
public static
UInt128
ReverseEndianness​(UInt128 value)
Reverses a primitive value by performing an endianness swap of the specified <see cref="T:System.UInt128" /> value.
Returns The reversed value.
value
The value to reverse.
public static
void
ReverseEndianness​(ReadOnlySpan<​int> source,
Span<​int> destination)
Copies every primitive value from <paramref name="source" /> to <paramref name="destination" /> , reversing each primitive by performing an endianness swap as part of writing each.
source
The source span to copy.
destination
The destination to which the source elements should be copied.
public static
void
ReverseEndianness​(ReadOnlySpan<​Int128> source,
Span<​Int128> destination)
Copies every primitive value from <paramref name="source" /> to <paramref name="destination" /> , reversing each primitive by performing an endianness swap as part of writing each.
source
The source span to copy.
destination
The destination to which the source elements should be copied.
public static
void
ReverseEndianness​(ReadOnlySpan<​long> source,
Span<​long> destination)
Copies every primitive value from <paramref name="source" /> to <paramref name="destination" /> , reversing each primitive by performing an endianness swap as part of writing each.
source
The source span to copy.
destination
The destination to which the source elements should be copied.
public static
void
ReverseEndianness​(ReadOnlySpan<​nint> source,
Span<​nint> destination)
Copies every primitive value from <paramref name="source" /> to <paramref name="destination" /> , reversing each primitive by performing an endianness swap as part of writing each.
source
The source span to copy.
destination
The destination to which the source elements should be copied.
public static
void
ReverseEndianness​(ReadOnlySpan<​short> source,
Span<​short> destination)
Copies every primitive value from <paramref name="source" /> to <paramref name="destination" /> , reversing each primitive by performing an endianness swap as part of writing each.
source
The source span to copy.
destination
The destination to which the source elements should be copied.
public static
void
ReverseEndianness​(ReadOnlySpan<​UIntPtr> source,
Span<​UIntPtr> destination)
Copies every primitive value from <paramref name="source" /> to <paramref name="destination" /> , reversing each primitive by performing an endianness swap as part of writing each.
source
The source span to copy.
destination
The destination to which the source elements should be copied.
public static
void
ReverseEndianness​(ReadOnlySpan<​uint> source,
Span<​uint> destination)
Copies every primitive value from <paramref name="source" /> to <paramref name="destination" /> , reversing each primitive by performing an endianness swap as part of writing each.
source
The source span to copy.
destination
The destination to which the source elements should be copied.
public static
void
ReverseEndianness​(ReadOnlySpan<​UInt128> source,
Span<​UInt128> destination)
Copies every primitive value from <paramref name="source" /> to <paramref name="destination" /> , reversing each primitive by performing an endianness swap as part of writing each.
source
The source span to copy.
destination
The destination to which the source elements should be copied.
public static
void
ReverseEndianness​(ReadOnlySpan<​ulong> source,
Span<​ulong> destination)
Copies every primitive value from <paramref name="source" /> to <paramref name="destination" /> , reversing each primitive by performing an endianness swap as part of writing each.
source
The source span to copy.
destination
The destination to which the source elements should be copied.
public static
void
ReverseEndianness​(ReadOnlySpan<​ushort> source,
Span<​ushort> destination)
Copies every primitive value from <paramref name="source" /> to <paramref name="destination" /> , reversing each primitive by performing an endianness swap as part of writing each.
source
The source span to copy.
destination
The destination to which the source elements should be copied.
public static
bool
TryReadDoubleBigEndian​(ReadOnlySpan<​byte> source,
Double& value)
public static
bool
TryReadDoubleLittleEndian​(ReadOnlySpan<​byte> source,
Double& value)
public static
bool
TryReadHalfBigEndian​(ReadOnlySpan<​byte> source,
Half& value)
public static
bool
TryReadHalfLittleEndian​(ReadOnlySpan<​byte> source,
Half& value)
public static
bool
TryReadInt16BigEndian​(ReadOnlySpan<​byte> source,
Int16& value)
public static
bool
TryReadInt16LittleEndian​(ReadOnlySpan<​byte> source,
Int16& value)
public static
bool
TryReadInt32BigEndian​(ReadOnlySpan<​byte> source,
Int32& value)
public static
bool
TryReadInt32LittleEndian​(ReadOnlySpan<​byte> source,
Int32& value)
public static
bool
TryReadInt64BigEndian​(ReadOnlySpan<​byte> source,
Int64& value)
public static
bool
TryReadInt64LittleEndian​(ReadOnlySpan<​byte> source,
Int64& value)
public static
bool
TryReadInt128BigEndian​(ReadOnlySpan<​byte> source,
Int128& value)
public static
bool
TryReadInt128LittleEndian​(ReadOnlySpan<​byte> source,
Int128& value)
public static
bool
TryReadIntPtrBigEndian​(ReadOnlySpan<​byte> source,
IntPtr& value)
public static
bool
TryReadIntPtrLittleEndian​(ReadOnlySpan<​byte> source,
IntPtr& value)
public static
bool
TryReadSingleBigEndian​(ReadOnlySpan<​byte> source,
Single& value)
public static
bool
TryReadSingleLittleEndian​(ReadOnlySpan<​byte> source,
Single& value)
public static
bool
TryReadUInt16BigEndian​(ReadOnlySpan<​byte> source,
UInt16& value)
public static
bool
TryReadUInt16LittleEndian​(ReadOnlySpan<​byte> source,
UInt16& value)
public static
bool
TryReadUInt32BigEndian​(ReadOnlySpan<​byte> source,
UInt32& value)
public static
bool
TryReadUInt32LittleEndian​(ReadOnlySpan<​byte> source,
UInt32& value)
public static
bool
TryReadUInt64BigEndian​(ReadOnlySpan<​byte> source,
UInt64& value)
public static
bool
TryReadUInt64LittleEndian​(ReadOnlySpan<​byte> source,
UInt64& value)
public static
bool
TryReadUInt128BigEndian​(ReadOnlySpan<​byte> source,
UInt128& value)
public static
bool
TryReadUInt128LittleEndian​(ReadOnlySpan<​byte> source,
UInt128& value)
public static
bool
TryReadUIntPtrBigEndian​(ReadOnlySpan<​byte> source,
UIntPtr& value)
public static
bool
TryReadUIntPtrLittleEndian​(ReadOnlySpan<​byte> source,
UIntPtr& value)
public static
bool
TryWriteDoubleBigEndian​(Span<​byte> destination,
double value)
Writes a <see cref="T:System.Double" /> into a span of bytes, as big endian.
Returns <see langword="true" /> if the span is large enough to contain a <see cref="T:System.Double" /> ; otherwise, <see langword="false" /> .
destination
The span of bytes where the value is to be written, as big endian.
value
The value to write into the span of bytes.
public static
bool
TryWriteDoubleLittleEndian​(Span<​byte> destination,
double value)
Writes a <see cref="T:System.Double" /> into a span of bytes, as little endian.
Returns <see langword="true" /> if the span is large enough to contain a <see cref="T:System.Double" /> ; otherwise, <see langword="false" /> .
destination
The span of bytes where the value is to be written, as little endian.
value
The value to write into the span of bytes.
public static
bool
TryWriteHalfBigEndian​(Span<​byte> destination,
Half value)
Writes a <see cref="T:System.Half" /> into a span of bytes, as big endian.
Returns <see langword="true" /> if the span is large enough to contain a <see cref="T:System.Half" /> ; otherwise, <see langword="false" /> .
destination
The span of bytes where the value is to be written, as big endian.
value
The value to write into the span of bytes.
public static
bool
TryWriteHalfLittleEndian​(Span<​byte> destination,
Half value)
Writes a <see cref="T:System.Half" /> into a span of bytes, as little endian.
Returns <see langword="true" /> if the span is large enough to contain a <see cref="T:System.Half" /> ; otherwise, <see langword="false" /> .
destination
The span of bytes where the value is to be written, as little endian.
value
The value to write into the span of bytes.
public static
bool
TryWriteInt16BigEndian​(Span<​byte> destination,
short value)
Writes an <see cref="T:System.Int16" /> into a span of bytes, as big endian.
Returns <see langword="true" /> if the span is large enough to contain an <see cref="T:System.Int16" /> ; otherwise, <see langword="false" /> .
destination
The span of bytes where the value is to be written, as big endian.
value
The value to write into the span of bytes.
public static
bool
TryWriteInt16LittleEndian​(Span<​byte> destination,
short value)
Writes an <see cref="T:System.Int16" /> into a span of bytes, as little endian.
Returns <see langword="true" /> if the span is large enough to contain an <see cref="T:System.Int16" /> ; otherwise, <see langword="false" /> .
destination
The span of bytes where the value is to be written, as little endian.
value
The value to write into the span of bytes.
public static
bool
TryWriteInt32BigEndian​(Span<​byte> destination,
int value)
Writes an <see cref="T:System.Int32" /> into a span of bytes, as big endian.
Returns <see langword="true" /> if the span is large enough to contain an <see cref="T:System.Int32" /> ; otherwise, <see langword="false" /> .
destination
The span of bytes where the value is to be written, as big endian.
value
The value to write into the span of bytes.
public static
bool
TryWriteInt32LittleEndian​(Span<​byte> destination,
int value)
Writes an <see cref="T:System.Int32" /> into a span of bytes, as little endian.
Returns <see langword="true" /> if the span is large enough to contain an <see cref="T:System.Int32" /> ; otherwise, <see langword="false" /> .
destination
The span of bytes where the value is to be written, as little endian.
value
The value to write into the span of bytes.
public static
bool
TryWriteInt64BigEndian​(Span<​byte> destination,
long value)
Writes an <see cref="T:System.Int64" /> into a span of bytes, as big endian.
Returns <see langword="true" /> if the span is large enough to contain an <see cref="T:System.Int64" /> ; otherwise, <see langword="false" /> .
destination
The span of bytes where the value is to be written, as big endian.
value
The value to write into the span of bytes.
public static
bool
TryWriteInt64LittleEndian​(Span<​byte> destination,
long value)
Writes an <see cref="T:System.Int64" /> into a span of bytes, as little endian.
Returns <see langword="true" /> if the span is large enough to contain an <see cref="T:System.Int64" /> ; otherwise, <see langword="false" /> .
destination
The span of bytes where the value is to be written, as little endian.
value
The value to write into the span of bytes.
public static
bool
TryWriteInt128BigEndian​(Span<​byte> destination,
Int128 value)
Writes a <see cref="T:System.Int128" /> into a span of bytes, as big endian.
Returns <see langword="false" /> if the span is too small to contain the value; otherwise, <see langword="true" /> .
destination
The span of bytes where the value is to be written, as big endian.
value
The value to write into the span of bytes.
public static
bool
TryWriteInt128LittleEndian​(Span<​byte> destination,
Int128 value)
Writes a <see cref="T:System.Int128" /> into a span of bytes, as little endian.
Returns <see langword="false" /> if the span is too small to contain the value; otherwise, <see langword="true" /> .
destination
The span of bytes where the value is to be written, as little endian.
value
The value to write into the span of bytes.
public static
bool
TryWriteIntPtrBigEndian​(Span<​byte> destination,
nint value)
Writes a <see cref="T:System.IntPtr" /> into a span of bytes, as big endian.
Returns <see langword="false" /> if the span is too small to contain the value; otherwise, <see langword="true" /> .
destination
The span of bytes where the value is to be written, as big endian.
value
The value to write into the span of bytes.
public static
bool
TryWriteIntPtrLittleEndian​(Span<​byte> destination,
nint value)
Writes a <see cref="T:System.IntPtr" /> into a span of bytes, as little endian.
Returns <see langword="false" /> if the span is too small to contain the value; otherwise, <see langword="true" /> .
destination
The span of bytes where the value is to be written, as little endian.
value
The value to write into the span of bytes.
public static
bool
TryWriteSingleBigEndian​(Span<​byte> destination,
Single value)
Writes a <see cref="T:System.Single" /> into a span of bytes, as big endian.
Returns <see langword="true" /> if the span is large enough to contain a <see cref="T:System.Single" /> ; otherwise, <see langword="false" /> .
destination
The span of bytes where the value is to be written, as big endian.
value
The value to write into the span of bytes.
public static
bool
TryWriteSingleLittleEndian​(Span<​byte> destination,
Single value)
Writes a <see cref="T:System.Single" /> into a span of bytes, as little endian.
Returns <see langword="true" /> if the span is large enough to contain a <see cref="T:System.Single" /> ; otherwise, <see langword="false" /> .
destination
The span of bytes where the value is to be written, as little endian.
value
The value to write into the span of bytes.
public static
bool
TryWriteUInt16BigEndian​(Span<​byte> destination,
ushort value)
Writes a <see cref="T:System.UInt16" /> into a span of bytes, as big endian.
Returns <see langword="true" /> if the span is large enough to contain a <see cref="T:System.UInt16" /> ; otherwise, <see langword="false" /> .
destination
The span of bytes where the value is to be written, as big endian.
value
The value to write into the span of bytes.
public static
bool
TryWriteUInt16LittleEndian​(Span<​byte> destination,
ushort value)
Writes a <see cref="T:System.UInt16" /> into a span of bytes, as little endian.
Returns <see langword="true" /> if the span is large enough to contain a <see cref="T:System.UInt16" /> ; otherwise, <see langword="false" /> .
destination
The span of bytes where the value is to be written, as little endian.
value
The value to write into the span of bytes.
public static
bool
TryWriteUInt32BigEndian​(Span<​byte> destination,
uint value)
Writes a <see cref="T:System.UInt32" /> into a span of bytes, as big endian.
Returns <see langword="true" /> if the span is large enough to contain a <see cref="T:System.UInt32" /> ; otherwise, <see langword="false" /> .
destination
The span of bytes where the value is to be written, as big endian.
value
The value to write into the span of bytes.
public static
bool
TryWriteUInt32LittleEndian​(Span<​byte> destination,
uint value)
Writes a <see cref="T:System.UInt32" /> into a span of bytes, as little endian.
Returns <see langword="true" /> if the span is large enough to contain a <see cref="T:System.UInt32" /> ; otherwise, <see langword="false" /> .
destination
The span of bytes where the value is to be written, as little endian.
value
The value to write into the span of bytes.
public static
bool
TryWriteUInt64BigEndian​(Span<​byte> destination,
ulong value)
Writes a <see cref="T:System.UInt64" /> into a span of bytes, as big endian.
Returns <see langword="true" /> if the span is large enough to contain a <see cref="T:System.UInt64" /> ; otherwise, <see langword="false" /> .
destination
The span of bytes where the value is to be written, as big endian.
value
The value to write into the span of bytes.
public static
bool
TryWriteUInt64LittleEndian​(Span<​byte> destination,
ulong value)
Writes a <see cref="T:System.UInt64" /> into a span of bytes, as little endian.
Returns <see langword="true" /> if the span is large enough to contain a <see cref="T:System.UInt64" /> ; otherwise, <see langword="false" /> .
destination
The span of bytes where the value is to be written, as little endian.
value
The value to write into the span of bytes.
public static
bool
TryWriteUInt128BigEndian​(Span<​byte> destination,
UInt128 value)
Writes a <see cref="T:System.UInt128" /> into a span of bytes, as big endian.
Returns <see langword="false" /> if the span is too small to contain the value; otherwise, <see langword="true" /> .
destination
The span of bytes where the value is to be written, as big endian.
value
The value to write into the span of bytes.
public static
bool
TryWriteUInt128LittleEndian​(Span<​byte> destination,
UInt128 value)
Writes a <see cref="T:System.UInt128" /> into a span of bytes, as little endian.
Returns <see langword="false" /> if the span is too small to contain the value; otherwise, <see langword="true" /> .
destination
The span of bytes where the value is to be written, as little endian.
value
The value to write into the span of bytes.
public static
bool
TryWriteUIntPtrBigEndian​(Span<​byte> destination,
UIntPtr value)
Writes a <see cref="T:System.UIntPtr" /> into a span of bytes, as big endian.
Returns <see langword="false" /> if the span is too small to contain the value; otherwise, <see langword="true" /> .
destination
The span of bytes where the value is to be written, as big endian.
value
The value to write into the span of bytes.
public static
bool
TryWriteUIntPtrLittleEndian​(Span<​byte> destination,
UIntPtr value)
Writes a <see cref="T:System.UIntPtr" /> into a span of bytes, as little endian.
Returns <see langword="false" /> if the span is too small to contain the value; otherwise, <see langword="true" /> .
destination
The span of bytes where the value is to be written, as little endian.
value
The value to write into the span of bytes.
public static
void
WriteDoubleBigEndian​(Span<​byte> destination,
double value)
Writes a <see cref="T:System.Double" /> into a span of bytes, as big endian.
destination
The span of bytes where the value is to be written, as big endian.
value
The value to write into the span of bytes.
public static
void
WriteDoubleLittleEndian​(Span<​byte> destination,
double value)
Writes a <see cref="T:System.Double" /> into a span of bytes, as little endian.
destination
The span of bytes where the value is to be written, as little endian.
value
The value to write into the span of bytes.
public static
void
WriteHalfBigEndian​(Span<​byte> destination,
Half value)
Writes a <see cref="T:System.Half" /> into a span of bytes, as big endian.
destination
The span of bytes where the value is to be written, as big endian.
value
The value to write into the span of bytes.
public static
void
WriteHalfLittleEndian​(Span<​byte> destination,
Half value)
Writes a <see cref="T:System.Half" /> into a span of bytes, as little endian.
destination
The span of bytes where the value is to be written, as little endian.
value
The value to write into the span of bytes.
public static
void
WriteInt16BigEndian​(Span<​byte> destination,
short value)
Writes an <see cref="T:System.Int16" /> into a span of bytes, as big endian.
destination
The span of bytes where the value is to be written, as big endian.
value
The value to write into the span of bytes.
public static
void
WriteInt16LittleEndian​(Span<​byte> destination,
short value)
Writes an <see cref="T:System.Int16" /> into a span of bytes, as little endian.
destination
The span of bytes where the value is to be written, as little endian.
value
The value to write into the span of bytes.
public static
void
WriteInt32BigEndian​(Span<​byte> destination,
int value)
Writes an <see cref="T:System.Int32" /> into a span of bytes, as big endian.
destination
The span of bytes where the value is to be written, as big endian.
value
The value to write into the span of bytes.
public static
void
WriteInt32LittleEndian​(Span<​byte> destination,
int value)
Writes an <see cref="T:System.Int32" /> into a span of bytes, as little endian.
destination
The span of bytes where the value is to be written, as little endian.
value
The value to write into the span of bytes.
public static
void
WriteInt64BigEndian​(Span<​byte> destination,
long value)
Writes an <see cref="T:System.Int64" /> into a span of bytes, as big endian.
destination
The span of bytes where the value is to be written, as big endian.
value
The value to write into the span of bytes.
public static
void
WriteInt64LittleEndian​(Span<​byte> destination,
long value)
Writes an <see cref="T:System.Int64" /> into a span of bytes, as little endian.
destination
The span of bytes where the value is to be written, as little endian.
value
The value to write into the span of bytes.
public static
void
WriteInt128BigEndian​(Span<​byte> destination,
Int128 value)
Writes a <see cref="T:System.Int128" /> into a span of bytes, as big endian.
destination
The span of bytes where the value is to be written, as big endian.
value
The value to write into the span of bytes.
public static
void
WriteInt128LittleEndian​(Span<​byte> destination,
Int128 value)
Writes a <see cref="T:System.Int128" /> into a span of bytes, as little endian.
destination
The span of bytes where the value is to be written, as little endian.
value
The value to write into the span of bytes.
public static
void
WriteIntPtrBigEndian​(Span<​byte> destination,
nint value)
Writes a <see cref="T:System.IntPtr" /> into a span of bytes, as big endian.
destination
The span of bytes where the value is to be written, as big endian.
value
The value to write into the span of bytes.
public static
void
WriteIntPtrLittleEndian​(Span<​byte> destination,
nint value)
Writes a <see cref="T:System.IntPtr" /> into a span of bytes, as little endian.
destination
The span of bytes where the value is to be written, as little endian.
value
The value to write into the span of bytes.
public static
void
WriteSingleBigEndian​(Span<​byte> destination,
Single value)
Writes a <see cref="T:System.Single" /> into a span of bytes, as big endian.
destination
The span of bytes where the value is to be written, as big endian.
value
The value to write into the span of bytes.
public static
void
WriteSingleLittleEndian​(Span<​byte> destination,
Single value)
Writes a <see cref="T:System.Single" /> into a span of bytes, as little endian.
destination
The span of bytes where the value is to be written, as little endian.
value
The value to write into the span of bytes.
public static
void
WriteUInt16BigEndian​(Span<​byte> destination,
ushort value)
Writes a <see cref="T:System.UInt16" /> into a span of bytes, as big endian.
destination
The span of bytes where the value is to be written, as big endian.
value
The value to write into the span of bytes.
public static
void
WriteUInt16LittleEndian​(Span<​byte> destination,
ushort value)
Writes a <see cref="T:System.UInt16" /> into a span of bytes, as little endian.
destination
The span of bytes where the value is to be written, as little endian.
value
The value to write into the span of bytes.
public static
void
WriteUInt32BigEndian​(Span<​byte> destination,
uint value)
Writes a <see cref="T:System.UInt32" /> into a span of bytes, as big endian.
destination
The span of bytes where the value is to be written, as big endian.
value
The value to write into the span of bytes.
public static
void
WriteUInt32LittleEndian​(Span<​byte> destination,
uint value)
Writes a <see cref="T:System.UInt32" /> into a span of bytes, as little endian.
destination
The span of bytes where the value is to be written, as little endian.
value
The value to write into the span of bytes.
public static
void
WriteUInt64BigEndian​(Span<​byte> destination,
ulong value)
Writes a <see cref="T:System.UInt64" /> into a span of bytes, as big endian.
destination
The span of bytes where the value is to be written, as big endian.
value
The value to write into the span of bytes.
public static
void
WriteUInt64LittleEndian​(Span<​byte> destination,
ulong value)
Writes a <see cref="T:System.UInt64" /> into a span of bytes, as little endian.
destination
The span of bytes where the value is to be written, as little endian.
value
The value to write into the span of bytes.
public static
void
WriteUInt128BigEndian​(Span<​byte> destination,
UInt128 value)
Writes a <see cref="T:System.UInt128" /> into a span of bytes, as big endian.
destination
The span of bytes where the value is to be written, as big endian.
value
The value to write into the span of bytes.
public static
void
WriteUInt128LittleEndian​(Span<​byte> destination,
UInt128 value)
Writes a <see cref="T:System.UInt128" /> into a span of bytes, as little endian.
destination
The span of bytes where the value is to be written, as little endian.
value
The value to write into the span of bytes.
public static
void
WriteUIntPtrBigEndian​(Span<​byte> destination,
UIntPtr value)
Writes a <see cref="T:System.UIntPtr" /> into a span of bytes, as big endian.
destination
The span of bytes where the value is to be written, as big endian.
value
The value to write into the span of bytes.
public static
void
WriteUIntPtrLittleEndian​(Span<​byte> destination,
UIntPtr value)
Writes a <see cref="T:System.UIntPtr" /> into a span of bytes, as little endian.
destination
The span of bytes where the value is to be written, as little endian.
value
The value to write into the span of bytes.
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object