Convert string to Base 64 byte array in CSharp
Description
The following code shows how to convert string to Base 64 byte array.
Example
//w ww .ja v a 2 s .c om
using System;
using System.Data;
using System.Text.RegularExpressions;
using System.Text;
class Class1{
static void Main(string[] args){
foreach (byte b in Base64DecodeString("java2s.com")){
Console.WriteLine(b);
}
}
public static byte[] Base64DecodeString(string inputStr)
{
byte[] encodedByteArray = Convert.FromBase64CharArray(inputStr.ToCharArray(), 0, inputStr.Length);
return (encodedByteArray);
}
}