byte array to base64 string c# code example

Example 1: c# string to byte array

string author = "Mahesh Chand";  
// Convert a C# string to a byte array  
byte[] bytes = Encoding.ASCII.GetBytes(author);  

// Convert a byte array to a C# string. 
string str = Encoding.ASCII.GetString(bytes);

Example 2: base64 string to byte array c#

byte[] l_Data = Convert.FromBase64String(l_PlainText);

Example 3: convert array byte to string 64

byte[] temp_backToBytes = Convert.FromBase64String(temp_inBase64);

Example 4: c# byte array to base64

public static string ToBase64String (byte[] inArray, int offset, int length, Base64FormattingOptions options);