arrays - C# - Operating on multidimensional List<string[,]> - adding items -


from past hour try adding items multidimensional list. below short program code:

        list<string[,]> nums = new list<string[,]>();          (int = 0; < 11; i++)         {             (int j = 0; j < 11; j++)             {              }         } 

now, try add items in order:

nums[0,0] = i+j; nums[0,1] = i+j; nums[1,0] = i+j; 

and go on. should code completly diffrent way make dynamic 2 dimensional array can add items via interation or there way of using example "add" / "addrange" function this?

when try use example

nums[i].add(convert.tostring(i)); 

i end error:

error cs1061 'string[,]' not contain definition 'addrange' , no extension method 'addrange' accepting first argument of type 'string[,]' found (are missing using directive or assembly reference?)

same goes addrange.

honestly, searched in google , answers found related static multidimensional arrays, implemented code. not experienced arrays , gratefull fix problem.

thank , wish day/night. regards, michal

nums not array it's list have been initialized. should initialize array, fill , add the list like

    list<string[,]> nums = new list<string[,]>();     string[,] arr1 = new string[10, 10];     (int = 0; < 11; i++)     {         (int j = 0; j < 11; j++)         {           arr1[i,j] = "test"; // example         }     }     nums.add(arr1); 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -