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();