C# Convert ToBase64String(Byte[], Int32, Int32, Base64FormattingOptions)
Description
Convert ToBase64String(Byte[], Int32, Int32, Base64FormattingOptions)
converts a subset of an array of 8-bit unsigned integers to its equivalent
string representation that is encoded with base-64 digits. Parameters
specify the subset as an offset in the input array, the number of elements
in the array to convert, and whether to insert line breaks in the return value.
Syntax
Convert.ToBase64String(Byte[], Int32, Int32, Base64FormattingOptions)
has the following syntax.
[ComVisibleAttribute(false)]//w ww . j a v a2 s. c om
public static string ToBase64String(
byte[] inArray,
int offset,
int length,
Base64FormattingOptions options
)
Parameters
Convert.ToBase64String(Byte[], Int32, Int32, Base64FormattingOptions)
has the following parameters.
inArray
- An array of 8-bit unsigned integers.offset
- An offset in inArray.length
- The number of elements of inArray to convert.options
- InsertLineBreaks to insert a line break every 76 characters, or None to not insert line breaks.
Returns
Convert.ToBase64String(Byte[], Int32, Int32, Base64FormattingOptions)
method returns The string representation in base 64 of length elements of inArray, starting
at position offset.
Example
/*from w w w .ja va2s . com*/
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},2,3,Base64FormattingOptions.InsertLineBreaks));
}
}
The code above generates the following result.