wenxiangchao
3 天以前 b544d5cccd76735e034c8055918a50927b437474
HMI.Core/Util/HexUtil.cs
@@ -2,15 +2,15 @@
namespace HMI.Core.Util
{
    public class HexUtil
    {
        public static byte[] ToBytesFromHexString(string hexString)
        {
            //以 ' ' 分割字符串,并去掉空字符
            string[] chars = hexString.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            byte[] returnBytes;
            returnBytes = BitConverter.GetBytes(Convert.ToInt32(chars[0]));
            return returnBytes;
        }
    }
    //public class HexUtil
    //{
    //    public static byte[] ToBytesFromHexString(string hexString)
    //    {
    //        //以 ' ' 分割字符串,并去掉空字符
    //        string[] chars = hexString.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    //        byte[] returnBytes;
    //        returnBytes = BitConverter.GetBytes(Convert.ToInt32(chars[0]));
    //        return returnBytes;
    //    }
    //}
}