解决方法
你试过String.Split吗?
string[] allTokens = textBox1.Text.Split(new []{ ','},StringSplitOptions.RemoveEmptyEntries); int[] allInts = Array.ConvertAll<string,int>(allTokens,int.Parse);
如果格式无效,可以使用int.TryParse:
int num = 0; int[] allInts = allTokens .Where(s => int.TryParse(s,out num)) .Select(s => num) .ToArray();