C# Convert ToBase64String(Byte[], Base64FormattingOptions)
Description
Convert ToBase64String(Byte[], Base64FormattingOptions)
converts an array of 8-bit unsigned integers to its equivalent string
representation that is encoded with base-64 digits. A parameter specifies
whether to insert line breaks in the return value.
Syntax
Convert.ToBase64String(Byte[], Base64FormattingOptions)
has the following syntax.
[ComVisibleAttribute(false)]//from w w w. j av a 2s . c o m
public static string ToBase64String(
byte[] inArray,
Base64FormattingOptions options
)
Parameters
Convert.ToBase64String(Byte[], Base64FormattingOptions)
has the following parameters.
inArray
- An array of 8-bit unsigned integers.options
- InsertLineBreaks to insert a line break every 76 characters, or None to not insert line breaks.
Returns
Convert.ToBase64String(Byte[], Base64FormattingOptions)
method returns The string representation in base 64 of the elements in inArray.
Example
/* w w w . j a v a2s. co 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},Base64FormattingOptions.InsertLineBreaks));
}
}
The code above generates the following result.