Linq recipe #2, Convert a CSV string of numbers into an array of numbers

e.g. for every (n) item in the array, apply the Convert function to it and return that as the nth item in the new array

 

int[] strongValues = Array.ConvertAll(csvString.Split(‘,’), n => Convert.ToInt32(n));

Leave a comment