This project has moved and is read-only. For the latest updates, please go here.

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.

Syntax

string ToBase64String(byte[] @this)

Parameters

@this
The @this to act on.

Examples


 // Copyright (c) 2013 Jonathan Magnan (http://zzzportal.com)
 // All rights reserved.
 // Licensed under MIT License (MIT)
 // License can be found here: https://zextensionmethods.codeplex.com/license
 
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 using Z;
 
 namespace ExtensionMethods.Examples
 {
     [TestClass]
     public class System_ByteArray_ToBase64String
     {
         [TestMethod]
         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 7:48 PM by Jonathan_Magnan, version 1