Last active
October 29, 2020 11:11
-
-
Save mgravell/1177e9e07d310ca0eedcb0af64e680c3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
static class P | |
{ | |
static void Main() | |
{ | |
var bytes = new List<byte>(); | |
bytes.AddRange(new byte[] { 0, 1, 2, 3 }); | |
bytes.AddRange(new byte[] { 4, 5 }); | |
bytes.AddRange(new byte[] { 6, 7, 8 }); | |
var arr = bytes.ToArray(); | |
Console.WriteLine(BitConverter.ToString(arr)); | |
// ^^ 00-01-02-03-04-05-06-07-08 | |
var b64 = Convert.ToBase64String(arr); | |
Console.WriteLine(b64); | |
// ^^ AAECAwQFBgcI | |
var backAgain = Convert.FromBase64String(b64); | |
Console.WriteLine(BitConverter.ToString(backAgain)); | |
// ^^ 00-01-02-03-04-05-06-07-08 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment