Base 64 Encode with Convert class - CSharp System

CSharp examples for System:Converter

Description

Base 64 Encode with Convert class

Demo Code


using System.Threading.Tasks;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;//from www  . j  ava  2  s . c  o m

public class Main{
        /// <summary>
        /// base64 ???
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static string EnCode(string str)
        {
            byte[] bytes = Encoding.Default.GetBytes(str);
            return Convert.ToBase64String(bytes);
        }
}

Related Tutorials