Convert.ToBase64String : Convert « System « C# / C Sharp by API






Convert.ToBase64String

 
using System;
using System.IO;
using System.Text;

class MainClass
{
    public static void Main() 
    {

        byte[] b = Encoding.Unicode.GetBytes("string");

        // Return the Base64-encoded string.
        string str =  Convert.ToBase64String(b);
        Console.WriteLine(str);

        Convert.FromBase64String(str);

        // Return the decoded Unicode string.
        Console.WriteLine(Encoding.Unicode.GetString(b));


    }
}

   
  








Related examples in the same category

1.Convert.ChangeType
2.Convert.FromBase64CharArray
3.Convert.FromBase64String
4.Convert.ToBase64CharArray
5.Convert.ToInt32
6.Convert.ToUInt32