public void ReadOnlySpan_CanEncodeUInt64() { UInt64 valueToWrite = 179021235; UInt64 valueRead = 0; int numBytesExpected = 0, numBytesRead = 0; ReadOnlyMemory <byte> bytes; BufferWriter writer = new BufferWriter(); { writer.Write(valueToWrite); numBytesExpected = 8; writer.ActiveMemoryPosition.Should().Be(numBytesExpected); bytes = writer.LazinatorMemory.GetConsolidatedMemory(); valueRead = bytes.Span.ToUInt64(ref numBytesRead); valueRead.Should().Be(valueToWrite); numBytesRead.Should().Be(numBytesExpected); } }