111,097
社区成员




static void Main(string[] args)
{
Byte[] buff = new byte[8];
MemoryStream ms = new MemoryStream(buff);
BinaryReader br = new BinaryReader(ms);
BinaryWriter bw = new BinaryWriter(ms);
long l;
double d;
d = 1235.3424;
bw.Write(d);
ms.Seek(0, SeekOrigin.Begin);
l = br.ReadInt64();
Console.WriteLine("(double){0} binary convert to long is (long){1}", d,l);
Console.Read();
}
double d = 1235.3424;
long c = Marshal.ReadInt64(d, 0);
long l = BitConverter.ToInt64(buff, 0);
double d = 1235.3424;
long c = *(long*)&d;
double d = 1235.3424;
long c = BitConverter.ToInt64(BitConverter.GetBytes(d), 0);