Encoding myEncoding = Encoding.GetEncoding("utf-8");
2、 从string到byte[]
string sData = “字符串”;
byte[] myByte = myEncoding.GetBytes(sData);
3、 从byte[]到string
byte[] myByte = new byte[]{};
string sData = myEncoding.GetString(byte[] myByte);
Encoding myEncoding = Encoding.GetEncoding("utf-8");
string sData = “字符串”;
byte[] myByte = myEncoding.GetBytes(sData);
byte[] myByte = new byte[]{};
string sData = myEncoding.GetString(byte[] myByte);