C# Convert FromBase64CharArray

Description

Convert FromBase64CharArray 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.

Syntax

Convert.FromBase64CharArray has the following syntax.


public static byte[] FromBase64CharArray(
  char[] inArray,
  int offset,//from  ww  w. j a  v  a2s.c o m
  int length
)

Parameters

Convert.FromBase64CharArray has the following parameters.

  • inArray - A Unicode character array.
  • offset - A position within inArray.
  • length - The number of elements in inArray to convert.

Returns

Convert.FromBase64CharArray method returns

Example

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.


//from ww w.  java  2 s .co  m
using System;
public class MainClass
{
    public static void Main(String[] argv)
    {
        System.IO.StreamReader inFile = new System.IO.StreamReader("java2s.txt");
        char[] base64CharArray = new char[inFile.BaseStream.Length];

        byte[] binaryData;
        binaryData = System.Convert.FromBase64CharArray(base64CharArray,
                                         0,
                                         base64CharArray.Length);
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version