二进制数组的字符串形式转换为二进制Byte数组

            if ((sBinText.Length % 2) != 0)
                sBinText += " ";
            bLabelContent = new byte[sBinText.Length / 2];
            string sTmp;
            for (int i = 0; i < bLabelContent.Length; i++)
            {
                sTmp = sBinText.Substring(i * 2, 2);
                bLabelContent[i] = Convert.ToByte(sTmp, 16);
            }

 

posted on 2016-03-09 10:00  ToolBox  阅读(2380)  评论(0编辑  收藏  举报