怎么将string 转换为short类型

解决方案 »

  1.   

    short 也属于整型吧    int.parse();
      

  2.   

         Int16 aaa = 0;
         Int16.TryParse(sTest, out aaa);
      

  3.   


                    // 方法1
                    short a;
                    short.TryParse("123", out a);               
                    //方法2
                    short b = Convert.ToInt16("123");                // 方法3
                    short c = short.Parse("123");
      

  4.   


                    // 方法1
                    short a;
                    short.TryParse("123", out a);               
                    //方法2
                    short b = Convert.ToInt16("123");                // 方法3
                    short c = short.Parse("123");
      

  5.   

     //方法2
                    short b = Convert.ToInt16("123");                // 方法3
                    short c = short.Parse("123");
    这两个不是一样的吗
    --! 就像int.parse() 和Int32.parse() 一个意思
      

  6.   

    short b = Convert.ToInt16("123");  这样不行 我以前就用这个 就是不对。 再问下09 这个在转化后 是9还是09呀?