Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Convert.FromBase64CharArray Method

Converts a subset of a Unicode character array, which encodes binary data as base-64 digits, to an equivalent 8-bit unsigned integer array. Parameters specify the subset in the input array and the number of elements to convert.

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

static member FromBase64CharArray : 
        inArray:char[] * 
        offset:int * 
        length:int -> byte[] 

Parameters

inArray
Type: System.Char[]

A Unicode character array.

offset
Type: System.Int32

A position within inArray.

length
Type: System.Int32

The number of elements in inArray to convert.

Return Value

Type: System.Byte[]
An array of 8-bit unsigned integers equivalent to length elements at position offset in inArray.

ExceptionCondition
ArgumentNullException

inArray is a null reference (Nothing in Visual Basic).

ArgumentOutOfRangeException

offset or length is less than 0.

-or-

offset plus length indicates a position not within inArray.

FormatException

The length of inArray, ignoring white-space characters, is not zero or a multiple of 4.

-or-

The format of inArray is invalid. inArray contains a non-base-64 character, more than two padding characters, or a non-white-space character among the padding characters.

inArray is composed of base-64 digits, white-space characters, and trailing padding characters. 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 white-space characters, and their Unicode names and hexadecimal code points, are tab (CHARACTER TABULATION, U+0009), newline (LINE FEED, U+000A), carriage return (CARRIAGE RETURN, U+000D), and blank (SPACE, U+0020). An arbitrary number of white-space characters can appear in inArray because all white-space characters are ignored.

The valueless character, "=", is used for trailing padding. The end of inArray can consist of zero, one, or two padding characters.

Important noteImportant

The FromBase64CharArray method is designed to process a single character array that contains all the data to be decoded. To decode base-64 character data from a stream, use the System.Security.Cryptography.FromBase64Transform class.

The following example demonstrates the use of the FromBase64CharArray(Char[], Int32, Int32) method to decode UUencoded (base-64) data and save it as binary output.

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

The following example demonstrates the ToBase64CharArray(Byte[], Int32, Int32, Char[], Int32, Base64FormattingOptions) and FromBase64CharArray(Char[], Int32, Int32) methods. The input is divided into groups of three bytes (24 bits) each. Consequently, each group consists of four 6-bit numbers where each number ranges from decimal 0 to 63. In this example, there are 85 3-byte groups with one byte remaining. The first group consists of the hexadecimal values 00, 01, and 02, which yield four 6-bit values equal to decimal 0, 0, 4, and 2. Those four values correspond to the base-64 digits, "A", "A", "E", and "C", at the beginning of the output.

If an integral number of 3-byte groups does not exist, the remaining bytes are effectively padded with zeros to form a complete group. In this example, the value of the last byte is hexadecimal FF. The first 6 bits are equal to decimal 63, which corresponds to the base-64 digit "/" at the end of the output, and the next 2 bits are padded with zeros to yield decimal 48, which corresponds to the base-64 digit, "w". The last two 6-bit values are padding and correspond to the valueless padding character, "=".

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

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

.NET for Windows Store apps

Supported in: Windows 8

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone Silverlight 8.1, Windows Phone Silverlight 8

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft