Decode Base 64 to byte array - CSharp System

CSharp examples for System:String Base64

Description

Decode Base 64 to byte array

Demo Code


using System.Text;
using System;/*from   w w w  .jav  a2s. com*/

public class Main{

        public static byte[] DecodeBase64_byte(string result)
        {
            int modeX = result.Length % 4;
            if (modeX != 0)
            {
                for (int i = 0; i < 4 - modeX; i++)
                {
                    result = result + "=";
                }
            }
            byte[] bytes = Convert.FromBase64String(result);
            return bytes;
        }
}

Related Tutorials