如题,谢先!

解决方案 »

  1.   

    public byte Asc(string strByte)
    {
    Encoding asc=Encoding.ASCII;
    Byte[] encodeBytes=asc.GetBytes(strByte);
    return (Byte)encodeBytes.GetValue(0);
    }
      

  2.   

    private void button1_Click(object sender, System.EventArgs e)
    {
    //int a=Asc("a");
    byte[] b1=new byte[]{97};
    string s=Asc1(b1);
    } public byte Asc(string strByte)//a -> 97 
    {
    Encoding asc=Encoding.ASCII;
    Byte[] encodeBytes=asc.GetBytes(strByte);
    return (Byte)encodeBytes.GetValue(0);
    } public string Asc1(byte[] by)97->a 
    {
    Encoding asc=Encoding.ASCII;
    char[] encodeBytes=asc.GetChars(by);
    return encodeBytes[0].ToString();
    }
      

  3.   

    直接 int i = 97
    然后
    char a = (char)i;
    就ok了
      

  4.   

    char c1 = 'a';
    int i1 = (int)c1;int i2 = 98;
    char c2 = (int)i2;