试试public static byte[] StringToByte(string InString) 
{
    byte[] ByteOut;
    ByteOut = new byte[InString.Length];
    for (int i = 0;i< ByteOut.Length;i++) 
   {
      ByteOut[i] = Convert.ToByte(("0x" + InString[i]),16);
   } 
   return ByteOut;
}