I'm using Booksleeve to communicate with Redis from a C# code. The code first retrieves all the fields and values from a hash:
var vals = await Redis.Hashes.GetAll(0, redisKey);
The hash contains fields which have values of type long.
The call to Hashes.GetAll returns the field values as byte arrays. The question is, how can I convert this byte array to C# long?
For example, if I use Hashes.GetInt64 to retrieve the value, I get back 9684, which is correct. But I'm not able to convert the retrieved byte array to long so that it would match this value:
BitConverter.ToInt64(redisHashValue, 0) throws ArgumentException
BitConverter.ToInt32(redisHashValue, 0) returns 876099129
BitConverter.ToInt16(redisHashValue, 0) returns 13881