Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

multidimensional array of object c#

I use an array of array :

object[][] of =new object[lenght2][];

Now, what i want is to insert a new array into of[][], I try this :

 for (int i = 0; i < lenght2; i++)
  {
      Act = calcul_resporderbyact(responsable,v); // return array of object
      of[i] = Act;
 }

i want to know how to use some array from this multidimensional-array ??

like image 550
Nancy Avatar asked Mar 20 '26 20:03

Nancy


1 Answers

You have couple of mistakes, in your code object[,] of =new object[lenght2][];

[,] is not equal to [][]

you can try this:

object[][] of = new object[length2][];
of[i] = Act; //it means you can assign `new[] { new object() };`

Read this: Multidimensional Array [][] vs [,]

it says that [,] is multidimensional array and [][] is array of arrays. So for your use array of arrays is valid.

like image 65
Kamil Budziewski Avatar answered Mar 22 '26 08:03

Kamil Budziewski



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!