Below is the c# code that will convert the provided string into it's corresponding base64 string. This code will first convert the string into byte array, after that it will convert the array into base64 string.
String stringData = "hello world";
Byte[] byteData = Encoding.ASCII.GetBytes(stringData);
stringData = Convert.ToBase64String(byteData);
Console.WriteLine(stringData);
Comments