转换用System.Convert.ToByte.
可是只有8位大小,也就是只有小于256的能转换。那大于的要怎么办呢?
我要转换16位大小该怎么办呢?
有直接转换的函数么?

解决方案 »

  1.   

    直接转啊,Vonvert.toint32好像有参数吧?
      

  2.   

    sorry,写错了
    Convert.ToInt32
    我这没vs,记不太清了!
      

  3.   

    自己写的,可以进行数制转换
      private static int ConvertString(string value, int fromBase, int toBase)
            {
                int intValue = Convert.ToInt32(value, fromBase);
                string Value = Convert.ToString(intValue, toBase);
                return Convert.ToInt32(Value);
            }
      

  4.   

    很简单了int i = 17;
    string hexI = Convert.ToString(i,16);
      

  5.   

    哈哈,原来用tostring,看来是忘了!
    加深一下记忆!