System.ByteArray Extension Methods

Byte[].ToBase64String Method

A byte[] extension method that converts an array of 8-bit unsigned integers to its equivalent string
representation that is encoded with base-64 digits.


string ToBase64String(byte[] @this)


The @this to act on.


 // Copyright (c) 2013 Jonathan Magnan (
 // All rights reserved.
 // Licensed under MIT License (MIT)
 // License can be found here:
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 using Z;
 namespace ExtensionMethods.Examples
     public class System_ByteArray_ToBase64String
         public void ToBase64String()
             // Type
             var @this = new byte[] {0};
             // Examples
             string value = @this.ToBase64String(); // return "AA==";
             // Unit Test
             Assert.AreEqual("AA==", value);

Last edited Nov 23, 2013 at 6:48 PM by Jonathan_Magnan, version 1