i want to save a byte[] in a table of SQLite Database (Field datatype is BLOB).
In that array i want to save a negative Double value say -36524.063415093093 in byte format (Not in byte[] format)
Double b = -36524.063415093093;
// Signature is
// byte[] arr = new Byte[] {Double, byte, byte, byte};
When i write Convert.ToByte(b) it gives error & if i write (byte)b it returns 84.
but how to i convert 84 back to -36524.063415093093?
Please correct if my approach is wrong?
Your approach is wrong 😉
You cannot store a double (which requires 64 bits) into a single byte (which is only 8 bits). It’s impossible
You can get a byte array, which is just all the 64 bits spread across 8 bytes. This would let you store your double in a byte array. But you indicate that you don’t want that.