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