Parse multiple integer in list?

I got some multiple integer in string

string number = "1,2,3,4,5,6,7,8,9,10";

i trying to parse it become a list of

int[] numberList;

i wanna make them in list like this

int[0] = 1;
int[1] = 2;
int[2] = 3;

i don’t really understand what should i do for that, any help?

string number = “1,2,3,4,5,6,7,8,9,10”;
int[ ] numberList;

//Stores your number temperarly in string array
string [ ] temp = number.Split(‘,’);

if( temp != null )
numberList = new int [ temp.Length ];

for( int i = 0; i < temp.Length ; i++ ) {

int.TryParse( temp [ i ] , out numberList [ i ] );
}

Hope this works for you :wink:

got a bit wrong about your scripting,
it should be change

string [] temp = number.Split(',');

to

string [] temp = number.Split(','[0]);

because it use paramChar[ ]inside the Split,
but i can’t figure out why need put it,
you know why?

This was fine

string [] temp = number.Split(',');

or use

string[] temp = number.Split(new char[] {','});