Let\'s say I have a web page that currently accepts a single ID value via a url parameter:
http://example.com/mypage.aspx?ID=1234
I want to change it to acce
List convertIDs = new List;
string[] splitIds = ids.split(',');
foreach(string s in splitIds)
{
convertIDs.Add(int.Parse(s));
}
For completeness you will want to put try/catches around the for loop (or around the int.Parse() call) and handle the error based on your requirements. You can also do a tryparse() like so:
List convertIDs = new List;
string[] splitIds = ids.split(',');
foreach(string s in splitIds)
{
int i;
int.TryParse(out i);
if (i != 0)
convertIDs.Add(i);
}