110,531
社区成员
发帖
与我相关
我的任务
分享
double aval = BitConverter.ToDouble(abuf, 0);
Console.WriteLine(aval);
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
double a = 1.23456;
double b = 2.34567;
byte[] abuf = BitConverter.GetBytes(a);
byte[] bbuf = BitConverter.GetBytes(b);
for (int i = 0; i < abuf.Length; ++i)
{
Console.Write("{0:X2} ", abuf[i]);
}
Console.WriteLine();
for (int i = 0; i < bbuf.Length; ++i)
{
Console.Write("{0:X2} ", bbuf[i]);
}
Console.Write("Press any key to over program......");
Console.ReadKey();
}
}
}
using System;
class Program
{
static void Main()
{
double a = 1.23456;
byte[] abuf = BitConverter.GetBytes(a);
Console.WriteLine(BitConverter.ToString(abuf));
// 输出:38-32-8F-FC-C1-C0-F3-3F
}
}