Domanda

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.

È stato utile?

Soluzione

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);

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top