Double.doubleToLongBits equivalent in C#?

2019-06-17 19:31发布

问题:

there's a Java method Double.doubleToLongBits that basically gets a double and return a long with the same bits.
How can I do it in C#?
Thank you

回答1:

BitConverter.DoubleToInt64Bits would be a good alternative.

http://msdn.microsoft.com/en-us/library/system.bitconverter.doubletoint64bits.aspx



回答2:

You'll want BitConverter.DoubleToInt64Bits