private ClockSnapshot ReadClockSnapshotFromBuffer(ServiceCtx context, IpcPtrBuffDesc ipcDesc) { Debug.Assert(ipcDesc.Size == Marshal.SizeOf <ClockSnapshot>()); using (BinaryReader bufferReader = new BinaryReader(new MemoryStream(context.Memory.ReadBytes(ipcDesc.Position, ipcDesc.Size)))) { return(bufferReader.ReadStruct <ClockSnapshot>()); } }
private ClockSnapshot ReadClockSnapshotFromBuffer(ServiceCtx context, IpcPtrBuffDesc ipcDesc) { Debug.Assert(ipcDesc.Size == (ulong)Marshal.SizeOf <ClockSnapshot>()); byte[] temp = new byte[ipcDesc.Size]; context.Memory.Read(ipcDesc.Position, temp); using (BinaryReader bufferReader = new BinaryReader(new MemoryStream(temp))) { return(bufferReader.ReadStruct <ClockSnapshot>()); } }