String - DecodeBase64
A string extension method that decode a Base64 String.
public static void Main() { string str = "RW50aXR5RnJhbWV3b3Jr"; // C# Extension Method: String - DecodeBase64 string decodeBase64 = str.DecodeBase64(); Console.WriteLine(decodeBase64); }
View Source
using System; using System.Text; public static partial class Extensions { /// <summary> /// A string extension method that decode a Base64 String. /// </summary> /// <param name="this">The @this to act on.</param> /// <returns>The Base64 String decoded.</returns> public static string DecodeBase64(this string @this) { return Encoding.ASCII.GetString(Convert.FromBase64String(@this)); } }