CSharp examples for System:String Base64
Base64 Encode
using System.Text; using System.Security.Cryptography; using System.Linq; using System.IO;/*from w w w .ja v a2 s .c om*/ using System.Globalization; using System.Collections.Generic; using System; public class Main{ public static string Base64Encode(this string toEncode) { var stream = new MemoryStream(); var writer = new StreamWriter(stream); writer.Write(toEncode); writer.Flush(); var buffer = new byte[stream.Length]; stream.Position = 0; stream.Read(buffer, 0, (int)stream.Length); var base64Value = Convert.ToBase64String(buffer); return base64Value; } }