Skip to main content

Class Base64Converter

Converts byte arrays to base64 encoded strings and vice versa.

Declaration
public static class Base64Converter

Methods

Encode(byte[])

Encodes a value using base64 encoding (RFC-4648).

Declaration
public static string Encode(byte[] value)
Returns

System.String: A base64 encoded string representation of the value.

Parameters
TypeNameDescription
System.Byte[]valueA byte array to encode.

Encode(byte[], int, int)

Encodes a value using base64 encoding (RFC-4648).

Declaration
public static string Encode(byte[] value, int offset, int length)
Returns

System.String: A base64 encoded string representation of the value.

Parameters
TypeNameDescription
System.Byte[]valueA byte array to encode.
System.Int32offsetA 0-based offset in the value.
System.Int32lengthThe number of bytes to encode.

Decode(string)

Decodes a value using base64 encoding (RFC-4648).

Declaration
public static byte[] Decode(string value)
Returns

System.Byte[]: A byte array representation of the value.

Parameters
TypeNameDescription
System.StringvalueA string encoded in base64.