AppStore.Templates.FlashCardPage.base64image C# (CSharp) Method

base64image() public static method

It converts string in Base64 to the Bitmap image.
public static base64image ( string base64string ) : System.Threading.Tasks.Task
base64string string
return System.Threading.Tasks.Task
        public static async System.Threading.Tasks.Task<BitmapImage> base64image(string base64string)
        {
            byte[] fileBytes = Convert.FromBase64String(base64string);
            using (InMemoryRandomAccessStream stream = new InMemoryRandomAccessStream())
            {
                await stream.WriteAsync(fileBytes.AsBuffer(0, fileBytes.Length));
                stream.Seek(0);
                BitmapImage image = new BitmapImage();
                await image.SetSourceAsync(stream);
                return image;
            }
        }
    }