Base64 to String [C#]

C# convert string to base64

In this post we will see how to convert Base64 string to string. .Net provides .FromBase64String() method in System.Convert class to convert Base64 string to string. While converting Base64 string to string it first converts base64 string to byte array and then byte array converted to string.

Sample code to convert Base64 string to string [C#]


//Convert Base64 string to string
public static string Base64ToString(string strBase64)       
{  
byte[] byteArray = Convert.FromBase64String(strBase64);            
return(System.Text.Encoding.UTF8.GetString(byteArray));        
}

0 Comments :

Post a Comment