Sunday, September 25, 2011

C#: Encode String into base64

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);

No comments:

Get function name programaticaly - Python

This little piece of code will help you to get the function name programatically. This is very helpful when you are implementing the debug...