编码:
byte [] bytes = Encoding.Default.GetBytes( " 要转换的字符串 " ); Convert.ToBase64String(bytes);
解码:
// "ztKwrsTj"是“我爱你”的base64编码 byte [] outputb = Convert.FromBase64String( " ztKwrsTj " ); string orgStr = Encoding.Default.GetString(outputb);
编码:
byte [] bytes = Encoding.Default.GetBytes( " 要转换的字符串 " ); Convert.ToBase64String(bytes);
解码:
// "ztKwrsTj"是“我爱你”的base64编码 byte [] outputb = Convert.FromBase64String( " ztKwrsTj " ); string orgStr = Encoding.Default.GetString(outputb);