3C科技 娛樂遊戲 美食旅遊 時尚美妝 親子育兒 生活休閒 金融理財 健康運動 寰宇綜合

Zi 字媒體

2017-07-25T20:27:27+00:00
加入好友
C# 二進位陣列(檔案) 和 Base64字串 互轉 資料來源:https://msdn.microsoft.com/zh-tw/library/dhx0d524(v=vs.110).aspx using System; public class Example {    public static void Main()    {        // Define a byte array.        byte[] bytes = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 };        Console.WriteLine(“The byte array: “);        Console.WriteLine(”   {0}\n”, BitConverter.ToString(bytes));        // Convert the array to a base 64 sring.        String s = Convert.ToBase64String(bytes);        Console.WriteLine(“The base 64 string:\n   {0}\n”, s);        // Restore the byte array.        byte[] newBytes = Convert.FromBase64String(s);        Console.WriteLine(“The restored byte array: “);        Console.WriteLine(”   {0}\n”, BitConverter.ToString(newBytes));    } } // The example displays the following output: //     The byte array: //        02-04-06-08-0A-0C-0E-10-12-14 //      //     The base 64 string: //        AgQGCAoMDhASFA== //      //     The restored byte array: //        02-04-06-08-0A-0C-0E-10-12-14        

本文由jashliaoeuwordpress提供 原文連結

寫了 5860316篇文章,獲得 23313次喜歡
精彩推薦