This documentation is archived and is not being maintained.

Convert.ToBase64String Method (Byte[], Int32, Int32)

.NET Framework 1.1

Converts the value of a subset of an array of 8-bit unsigned integers to its equivalent String representation consisting of base 64 digits. Parameters specify the subset as an offset in the input array and the number of elements in the array to convert.

[Visual Basic]
Overloads Public Shared Function ToBase64String( _
   ByVal inArray() As Byte, _
   ByVal offset As Integer, _
   ByVal length As Integer _
) As String
public static string ToBase64String(
 byte[] inArray,
 int offset,
 int length
public: static String* ToBase64String(
 unsigned char inArray __gc[],
 int offset,
 int length
public static function ToBase64String(
   inArray : Byte[],
 offset : int,
 length : int
) : String;


An array of 8-bit unsigned integers.
An offset in inArray.
The number of elements of inArray to convert.

Return Value

The String representation in base 64 of length elements of inArray starting at position offset.


Exception Type Condition
ArgumentNullException inArray is a null reference (Nothing in Visual Basic).
ArgumentOutOfRangeException offset or length is negative.


offset plus length is greater than the length of inArray.


The elements of inArray are taken as a numeric value and converted to a String representation in base 64.

The base 64 digits in ascending order from zero are the uppercase characters 'A' to 'Z', lowercase characters 'a' to 'z', numerals '0' to '9', and the symbols '+' and '/'. The valueless character, '=', is used for trailing padding.

offset and length are 32-bit signed numbers. offset is zero-based.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

Convert Class | Convert Members | System Namespace | Convert.ToBase64String Overload List