c# base64 image to byte array code example

Example 1: base64 string to byte array c#

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

Example 2: c# image to byte array

public byte[] ImageToByteArray(System.Drawing.Image imageIn)
{
   using (var ms = new MemoryStream())
   {
      imageIn.Save(ms,imageIn.RawFormat);
      return  ms.ToArray();
   }
}

Example 3: c# byte array to base64

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

Example 4: byte array to base64 c#

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