Wednesday, June 18, 2008

String array to Int array

Note to self, putting it down in writing so I don't forget it for the umpteenth time.

string stringOfNumbers = "1,2,3,4,5,6,7";
string[] stringNumbers = stringOfNumbers.Split(',');
int[] numbers = Array.ConvertAll(stringNumbers, s => int.Parse(s));

No comments: