/// <summary> /// ASCII转字符串 /// </summary> /// <param name="asciiCode">ASCII对应十进制码</param> /// <returns></returns> public static string ASCIIToStr(int asciiCode) { if (asciiCode >= 0 && asciiCode <= 255) { System.Text.ASCIIEncoding asciiEncoding = new System.Text.ASCIIEncoding(); byte[] byteArray = new byte[] { (byte)asciiCode }; string strCharacter = asciiEncoding.GetString(byteArray); return (strCharacter); } else { throw new Exception("ASCII Code is not valid."); } }