tags:

views:

448

answers:

2

I have a string has numbers

string sNumbers = "1,2,3,4,5";

Split it then Convert To List

sNumbers.Split( new[] { ',' } ).ToList<int>();

How can i convert string array to integer list?

So i need to convert string[] to IEnumerable ...

+15  A: 
var numbers = sNumbers.Split(',').Select(n => int.Parse(n)).ToList();
mquander
Too fast answer :)
uzay95
+1  A: 

We had exactly the same question today: Click me

Dario