日期:2014-05-18 浏览次数:20833 次
float ff = 3.14F; byte[] bb = BitConverter.GetBytes(ff); Array.Reverse(bb); string s = BitConverter.ToString(bb); // s="40-48-F5-C3"
string[] list=s.Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries); byte[] buf=new byte[list.Length]; for (int i = 0; i < list.Length; i++) buf[i] =byte.Parse(list[i],System.Globalization.NumberStyles.AllowHexSpecifier);