日期:2014-05-20  浏览次数:20875 次

如何将浮点数转换成为十六进数
如何将浮点数转换成为十六进数

------解决方案--------------------
Convert.ToString(100.00, 16)

Decimal.Parse( "100.00 ", System.Globalization.NumberStyles.HexNumber)

好像是这样的,都试试吧。记不清楚了。
------解决方案--------------------
1234.5678 -> AD FA 5C 6D 45 4A 93 40

这样吗?

MemoryStream vMemoryStream = new MemoryStream();
BinaryWriter vBinaryWriter = new BinaryWriter(vMemoryStream);
double vDouble = 1234.5678;
vBinaryWriter.Write(vDouble);

byte[] vBuffer = new byte[sizeof(double)];
vMemoryStream.Seek(0, SeekOrigin.Begin);
vMemoryStream.Read(vBuffer, 0, vBuffer.Length);

Text = BitConverter.ToString(vBuffer).Replace( "- ", " ");