Results 1 to 2 of 2

Thread: [2.0] array question

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2003
    Posts
    436

    [2.0] array question

    I have elements in a 2 dimensional array.

    Code:
     string[,] ParamsValues = { {"1Month", "1 Month"},
                                            {"2Months", "2 Months" },
                                            { "3Months", "3 Months"}};
    I would like to go thru the array and assign ParamsValues[0,1] to ParamsValues[0,0] so on and so forth.

    How can I do this ?


    I tried something like this and it didn't work.

    Code:
    for (int i = 0; i < ParamsValues.GetLength(0); i++)
                {
                    for (int j = 0; j < ParamsValues.GetLength(1); j++)
                    {
                        k = ParamsValues[i, j];
                        string l = ParamsValues[i, j];
                    }
                        //Console.WriteLine(k);
                }
    thanks
    nath

  2. #2
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: [2.0] array question

    Code:
    string[,] ParamsValues = { {"1Month", "1 Month"},{"2Months", "2 Months" },{ "3Months", "3 Months"}};
    for (int i = 0; i < ParamsValues.Length; i++)
    {
    	for (int j = 0; j < ParamsValues[i].Length; j++)
    	{
    		k = ParamsValues[i, j];
    		string l = ParamsValues[i, j];
    	}
    	//Console.WriteLine(k);
    }
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width