一、类型转换实例
将文本框中输入的string字符串转换为形同内容的byte数组:
1、C#内置的Convert类方法
Convert.ToByte(value) 将指定类型转换为 Byte
2、依次获取字符串中的2个字符转换成byte
static byte[] StringToByteArray(string hex)
{
if (hex.Length % 2 != 0)
throw new ArgumentException(hex + " is not a valid hex string!");
byte[] ret = new byte[hex