C # Implementation of BASE64 encoding and decoding __

Source: Internet
Author: User
Tags base64

The function of encoding and decoding that has been integrated with the vs2013,c# has been implemented with the invocation of the conversion function Base64.


The main implementation code is as follows:



Using System;
Using System.Collections.Generic;
Using System.ComponentModel;
Using System.Data;
Using System.Drawing;
Using System.Linq;
Using System.Text;
Using System.Windows.Forms;

Namespace Base64_v1
{public
    partial class Base64:form
    {public
        Base64 ()
            { InitializeComponent ();
        }

        private void Btn_base64_encode_click (object sender, EventArgs e)
        {
            byte[] InArray = System.Text.Encoding.UTF8.GetBytes (TXT_BASE64_SRC. Text);
            Txt_base64_dst. Text = convert.tobase64string (InArray);
        }

        private void Btn_base64_decode_click (object sender, EventArgs e)
        {
            byte[] InArray = convert.frombase64string (TXT_BASE64_SRC. Text);
            Txt_base64_dst. Text = System.Text.Encoding.UTF8.GetString (InArray);}}}



Run effect









Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.