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));

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s