C# Convert ToBase64String(Byte[], Int32, Int32)

Description

Convert ToBase64String(Byte[], Int32, Int32) 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, and the number of elements in the array to convert.

Syntax

Convert.ToBase64String(Byte[], Int32, Int32) has the following syntax.


public static string ToBase64String(
  byte[] inArray,
  int offset,/* w w w .ja  va 2 s  .c o  m*/
  int length
)

Parameters

Convert.ToBase64String(Byte[], Int32, Int32) 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.

Returns

Convert.ToBase64String(Byte[], Int32, Int32) method returns The string representation in base 64 of length elements of inArray, starting at position offset.

Example


/* ww w.  java 2 s. c  o  m*/
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));
  }
}

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