反过来,byte[]转成string:
其它编码方式的,如System.Text.UTF8Encoding,System.Text.UnicodeEncoding class等;例如:
string类型转成ASCII byte[]:("01" 转成 byte[] = new byte[]{ 0x30, 0x31})
ASCII byte[] 转成string:(byte[] = new byte[]{ 0x30, 0x31} 转成 "01")
有时候还有这样一些需求:
byte[] 转成原16进制格式的string,例如0xae00cf, 转换成 "ae00cf";new byte[]{ 0x30, 0x31}转成"3031":public static string ToHexString ( byte[] bytes ) // 0xae00cf => "AE00CF "