I have a Visual Studio 2008 C#.NET 3.5 application where I have a string with a list of numbers separated by a semicolon.
string num_list = "1;2;3;4;201;2099;84"
I would like to convert that to a List<int>. Is there an easier way than this?
List<int> foo = new List<int>();
foreach (string num in num_list.Split(';'))
foo.Add(Convert.ToInt32(num));
Thanks,
PaulH
1 Answer