我怎么能转换逗号分隔字符串转换成一个List< INT>

问题描述:

string tags = "9,3,12,43,2"

List<int> TagIds = tags.Split(',');

这不工作导致拆分方法返回一个字符串[]

This doesnt work cause the split method returns a string[]

请帮忙。

下面是这样做的一种方式:

Here is one way of doing it:

List<int> TagIds = tags.Split(',').Select(int.Parse).ToList();