Converts byte[] to base64 string. - CSharp System

CSharp examples for System:String Base64

Description

Converts byte[] to base64 string.

Demo Code


using System.Text;
using System.Reflection;
using System.Linq;
using System.Collections.Generic;
using System;/*w w w  .ja  va 2s. c o m*/

public class Main{
        /// <summary>
        /// Converts byte[] to base64 string.
        /// </summary>
        /// <param name="bytes">Byte[] to be converted</param>
        /// <exception cref="System.ArgumentNullException"></exception>
        /// <returns>The string that represents the byte[]</returns>
        public static string BytesToStringBase64(byte[] bytes)
        {
            return Convert.ToBase64String(bytes);
        }
}

Related Tutorials