Takes a string and turns it into a base-64 Unicode string
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
namespace FStore.Utils
{
/// <summary>
/// Class containing utilities used internally and available for external use
/// </summary>
public static class PublicUtils
{
/// <summary>
/// Takes a string and turns it into a base-64 Unicode string
/// </summary>
/// <param name="data">The string to convert to base-64</param>
/// <returns>The base-64 string</returns>
public static string UAsBase64(this string data)
{
return UAsBase64(data, Encoding.Unicode);
}
/// <summary>
/// Takes a string and turns it into a base-64 string of a given encoding
/// </summary>
/// <param name="data">The string to convert to base-64</param>
/// <param name="enc">The encoding to use</param>
/// <returns>The base-64 string</returns>
public static string UAsBase64(this string data, Encoding enc)
{
return Convert.ToBase64String(enc.GetBytes(data));
}
}
}
Related examples in the same category