var string splitStr=“1,2,3,4,5,6”;
1、List<int> listCode = splitStr.Split(new Char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
.Select(Int32.Parse).ToList();
2、List<int> listCode = Array
.ConvertAll(splitStr
.Split(new Char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), x => int.Parse(s)).ToList();
3、 List<int> listCode = Array
.ConvertAll(splitStr
.Split(new Char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), int.Parse).ToList();
如果不确定字符串是否为数字:.Select(x => int.TryParse(x , out n) ? n : 0)