string --> byte[]
byte[] data=Syste.Text.Encoding.ASCII.GetBytes(string);
byte[]-->string
string string1= Encoding.ASCII.GetString( bytes, 0, bytesSize );
如果有中文字符
把Encoding.ASCII换成Encoding.GetEncoding("gb2312")
转载于:https://www.cnblogs.com/renrenqq/archive/2006/08/02/465831.html