The answer was very simple:
double value = 19500.00;
This gives the bytes:
var bytes = BitConverter.GetBytes(value);
This gives the double again:
var value = BitConverter.ToDouble(bytes, 0);
Вопрос
Hope you can help me with this problem.
I am working for a client and in his technical notes I need to SEND a double value to a IEEE Floating 8byte point in C#. This is just the one part, after that I need to be able to RECEIVE a IEEE Floating 8byte point and extract the double from it.
The specific value that I am receiving is 19500.00.
I have been searching the net a while, but think my Google skills left me hanging!
Any help will be appreciated, but code will be preferred.
Решение
The answer was very simple:
double value = 19500.00;
This gives the bytes:
var bytes = BitConverter.GetBytes(value);
This gives the double again:
var value = BitConverter.ToDouble(bytes, 0);