C# Convert ToBase64String(Byte[])

Description

Convert ToBase64String(Byte[]) converts an array of 8-bit unsigned integers to its equivalent string representation that is encoded with base-64 digits.

Syntax

Convert.ToBase64String(Byte[]) has the following syntax.


public static string ToBase64String(
  byte[] inArray
)

Parameters

Convert.ToBase64String(Byte[]) has the following parameters.

  • inArray - An array of 8-bit unsigned integers.

Returns

Convert.ToBase64String(Byte[]) method returns The string representation, in base 64, of the contents of inArray.

Example


/*from www. j a v a2s  .  c  o  m*/
using System;
public class MainClass{
  public static void Main(String[] argv){  
    Console.WriteLine(Convert.ToBase64String(new Byte[]{1,2,3,4,5,6,7,8}));
  }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version