c# assign 1 dimensional array to 2 dimensional array syntax

前端 未结 4 1580
孤街浪徒
孤街浪徒 2021-02-07 10:10

I want to do something like:

object[] rowOfObjects = GetRow();//filled somewhere else
object[,] tableOfObjects = new object[10,10];

tableOfObjects[0] = rowOfObj         


        
4条回答
  •  攒了一身酷
    2021-02-07 10:22

    So, Something like:

        public static object[] GetRow()
        {
            object[,] test = new object[10,10];
            int a = 0;
            object[] row = new object[10];
            for(a = 0; a <= 10; a++)
            {
                row[a] = test[0, a];
            }
            return row;
        }
    

提交回复
热议问题