using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnConvert_Click(object sender, EventArgs e)
{
string str = txtInput.Text;
//byte[] bys = Encoding.GetEncoding("ascii").GetBytes(str);
byte[] bys = Encoding.GetEncoding("unicode").GetBytes(str);
txtCode.Text = bys[0].ToString();
}
private void btnConvertBack_Click(object sender, EventArgs e)
{
int temp = -1;
if (int.TryParse(txtCode.Text,out temp))
{
txtInput.Text = ((char)temp).ToString();
}
}
}
}