//命令码0x8001转为int为32769,发送时反序
            byte[] bt = new byte[2] { 0x01, 0x80 };
            int lt1 = BitConverter.ToUInt16(bt, 0);

            //int to byte[]
            int i = 6231;
            byte[] b = BitConverter.GetBytes(i);

            //byte[] to int
            byte[] bb = new byte[] { 87, 24, 0, 0 };
            uint j = BitConverter.ToUInt32(bb,0);
            //sTemp=0x 57-18-00-00
            string sTemp = BitConverter.ToString(bb);

 

posted on 2014-12-11 17:37  AmyAlisa  阅读(141)  评论(0编辑  收藏  举报