#region 对字符串进行Base64编码
/// <summary>
/// 对字符串进行Base64编码
/// </summary>
/// <param name="source"></param>
/// <returns>string</returns>
public static string Base64EnCode(this string source)
{
byte[] bytes = UTF8Encoding.UTF8.GetBytes(source);
return Convert.ToBase64String(bytes);
}
#endregion
#region 对字符串进行Base64解码
/// <summary>
/// 对字符串进行Base64解码
/// </summary>
/// <param name="source"></param>
/// <returns>string</returns>
public static string Base64Decode(this string source)
{
byte[] bytes = Convert.FromBase64String(source);
return UTF8Encoding.UTF8.GetString(bytes);
}
#endregion