Below is my code

string strpos2 = System.Configuration.ConfigurationManager.AppSettings["arraycolumn"];
        char[] sep2 = { ',' };
        string[] number = strpos2.Split(sep2);

number contain array of string
how can i assign this array of string to int[]

Recommended Answers

You'll have to convert them:

int[] myInts = new int[number.Length];
for(int i = 0; i < number.Length; i++) {
    if (Int32.TryParse(number[i], out myInts[i]) == false) {
        // conversion failed, it wasn't an integer
    }
}
Jump to Post

All 2 Replies

You'll have to convert them:

int[] myInts = new int[number.Length];
for(int i = 0; i < number.Length; i++) {
    if (Int32.TryParse(number[i], out myInts[i]) == false) {
        // conversion failed, it wasn't an integer
    }
}

Thanks Momerath for giving your valuable time
It helped me

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.