using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication1 { class Program { private static string HexAsciiToString(string _asciiHex) { string ascii = _asciiHex; List<byte> buffer = new List<byte>(); for (int i = 0; i < ascii.Length; i += 2) { string temp = ascii.Substring(i, 2); byte value = Convert.ToByte(temp, 16); buffer.Add(value); } return Encoding.ASCII.GetString(buffer.ToArray()); } static void Main(string[] args) { //例如"#"的Ascii码的十进制表示"35",16进制表示为"23".这里使用的是16进制 string test = HexAsciiToString("23"); //输出>>test = "#" } } }