String str = "1,2,3,4,5,6" 如何将这个字符串转换成int数组
String str = "1,2,3,4,5,6"; string[] strS = str.Split(','); int[] num = new int[strS.Length]; int number, i = 0; foreach (var item in strS) { if (int.TryParse(item, out number)) num[i++] = number; }
String str = "1,2,3,4,5,6"; var q = str.Split(',').Select(x => int.Parse(x)).ToList();
我们度尽的年岁,好像一声叹息,不过是劳苦愁烦,转眼成空