private void MarshalWriteDouble(IntPtr ptr, int offset, double value) { byte [] bytes = BitConverter.GetBytes(value); for(int i = 0; i < bytes.Length; i++) { Marshal.WriteByte(ptr, offset + i, bytes[i]); } }