我目前想要一个2D数组(4,4)看起来像这样:
outArr = new string[4, 4]
{
{"0","0","0","0" },
{"0","0","0","0" },
{"0","0","0","0" },
{"0","0","0","0" }
};
但是,我不确定在代码中如何处理数组大小在运行时可能是动态的(即3,5或10,10)
我找到了关于如何动态创建数组的示例(对于int数组):
int[,] myArray=new int[(int)s[0],(int)s[2]];
myArray[0, 0] = 2;
Console.WriteLine(myArray[0, 0]);
Console.ReadLine();
但我想知道如何创建元素" 0"在我的数组中动态。