Base64 String Encode and Decode Methods

Mutlaka bir yerlerde işimize yarayacağını düşündüm güzel bir method örneği;

public static string Base64StringEncode(this string value)
{
   byte[] toEncodeAsBytes= ASCIIEncoding.ASCII.GetBytes(value);
   string returnValue= Convert.ToBase64String(toEncodeAsBytes);
   return returnValue;
}
public static string Base64StringDecode(this string value)
{
   byte[] encodedDataAsBytes=Convert.FromBase64String(value);
   string returnValue= ASCIIEncoding.ASCII.GetString(encodedDataAsBytes);
   return returnValue;
}

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir