locked
1D array to 2D array RRS feed

  • Question

  • I have 1D array e.g.:
    string[] array = new string[3]; 
            array [0] = "id=1&value=string1";
            array [1] = "id=2&value=string2";
            array [2] = "id=3&value=string3";
    
    a i want get from this query sting 2D array like this:
    string[,] array = new string[,]
            {
                {"1", "string1"},
                {"2", "string2"},
                {"3", "string3"},
            };
    
    Thanks for response.
    Sunday, June 28, 2009 12:41 PM

Answers

  • Split the lines on the "=".
    Split the line array[1] on the "&"
    new string[,] = array[1][0], array[2]
    • Marked as answer by tommyv580 Sunday, June 28, 2009 5:27 PM
    Sunday, June 28, 2009 1:56 PM