C# 字符串转byte数组

public static byte[] HexstringToByte(string InString)

{

 

string[] ByteStrings;

 

ByteStrings = InString.Split(" ".ToCharArray());

 

byte[] ByteOut;

 

ByteOut = new byte[ByteStrings.Length];

 

for (int i = 0; i <= ByteStrings.Length - 1; i++)
{



ByteOut[i] = Byte.Parse(ByteStrings[i], System.Globalization.NumberStyles.HexNumber);



}

 

return ByteOut;

 

}
posted @ 2019-05-30 11:38  CHPowerljp  阅读(2887)  评论(0编辑  收藏  举报