I want to do something like:
object[] rowOfObjects = GetRow();//filled somewhere else
object[,] tableOfObjects = new object[10,10];
tableOfObjects[0] = rowOfObjects;
is this somehow possible and what is the syntax?
or I need to do this:
for (int i = 0; i < rowOfObjects.Length; i++)
{
tableOfObjects[0,i] = rowOfObjects[i];
}
and fill up the 2 dimensional arrays row using a loop?
Thanks
No, if you are using a two dimensional array it’s not possible. You have to copy each item.
If you use a jagged array, it works just fine:
If you are getting all the data as rows, you of course don’t need the loop that puts arrays in the array of arrays, as you would just replace them anyway.