[Mono-dev] Arrays in a loop?

Eric Scott scottishbug at cwazy.co.uk
Mon Oct 3 07:51:06 EDT 2005


    I have a newbie C# question that I've been having difficulties 
finding an answer to.  I have a global array, and am trying to assign 
data to it from as follows:

                int i = 0;

                foreach ( DataRow row in table.Rows )
                    {                   
                        {MyArray}[i, 0] = a;
                        {MyArray}[i, 1] = x;
                        {MyArray}[i, 2] = y;
                        {MyArray}[i, 3] = z;
                       
                        i ++;
                   }

    All the code executes properly once, but then stalls the second time 
it attempts to go through the loop.  I've gathered there's something 
quarky about using arrays in a loop like this, but I haven't found any 
down-to-earth explanations that let me know how to fix my code.
    Thanx for any help you can offer,
             SigmaX

-- 
My home page: www.sigmax.cjb.net

"Education is what remains after one has forgotten everything he learned in school"
	-Albert Einstein





More information about the Mono-devel-list mailing list