我知道的string[]转换为int[]只有一种
                string[] str1 = {"1","2","3","4"};
                int[] list = new int[str1.Length];
                int index = 0;
                while (index < list.Length)
                {
                    list[index] = Int32.Parse(str1[index]);
                    index++;
                }请问,还有没有其它更快更好的方法,谢谢

解决方案 »

  1.   


       string[] str1 = { "1", "2", "3", "4" };
                int[] list = new int[str1.Length];
                int index = 0;
                foreach(string str in str1)
                {
                    list[index] = Int32.Parse(str);
                    index++;
                }             string[] str1 = { "1", "2", "3", "4" };
                IList<int> list = new List<int>();
                foreach(string str in str1)
                {
                   list.Add(  Convert.ToInt32(str));
                } 这样?