Encoding.Base64Encode
Skip to content
mnscript
StringResult Encoding.Base64Encode(string) 

Description ​

Encodes a string to a Base64 representation.

Arguments ​

string - The string to convert.

Returns ​

StringResult - The Base64 representation.

Example ​

msc
using Encoding;
using System;

// Converts "Hello World!" to Base64

StringResult base64 = Encoding.CharsToBase64("Hello World!");

if(base64.GetResult()){
    // If the conversion was successful, the result will be in GetString.
    Console.WriteLine("Base64: "..base64.GetString());
}else{
    // If the conversion failed, the error reason will be in GetString.
    Console.WriteLine("Error: "..base64.GetString());
}