Convert.ToBase64CharArray Method (Byte[], Int32, Int32, Char[], Int32)

 

Converts a subset of an 8-bit unsigned integer array to an equivalent subset of a Unicode character array encoded with base-64 digits. Parameters specify the subsets as offsets in the input and output arrays, and the number of elements in the input array to convert.

Namespace:   System
Assembly:  mscorlib (in mscorlib.dll)

static member ToBase64CharArray : 
        inArray:byte[] *
        offsetIn:int *
        length:int *
        outArray:char[] *
        offsetOut:int -> int

Parameters

inArray
Type: System.Byte[]

An input array of 8-bit unsigned integers.

offsetIn
Type: System.Int32

A position within inArray.

length
Type: System.Int32

The number of elements of inArray to convert.

outArray
Type: System.Char[]

An output array of Unicode characters.

offsetOut
Type: System.Int32

A position within outArray.

Return Value

Type: System.Int32

A 32-bit signed integer containing the number of bytes in outArray.

Exception Condition
ArgumentNullException

inArray or outArray is null.

ArgumentOutOfRangeException

offsetIn, offsetOut, or length is negative.

-or-

offsetIn plus length is greater than the length of inArray.

-or-

offsetOut plus the number of elements to return is greater than the length of outArray.

The subset of length elements of inArray starting at position offsetIn, are taken as a numeric value and converted to a subset of elements in outArray starting at position offsetOut. The return value indicates the number of converted elements in outArray. The subset of outArray consists of base-64 digits.

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

The offset and length parameters are 32-bit signed numbers. The offsetIn and offsetOut parameters are zero-based array positions.

System_CAPS_importantImportant

The ToBase64CharArraymethod is designed to process a single byte array that contains all the data to be encoded. To create a base-64 character array from a byte stream, use the System.Security.Cryptography.ToBase64Transform class.

The following example demonstrates using the ToBase64CharArray method to UUencode (encode in base 64) a binary stream, then save the encoding to a file.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
Show: