我们一般说冲含迟的动态,是指老旅在运行过程中随时可以添加修改行列的,如果你已经确定知道要几行几列那就不是动态了,动态数组一般是用List实现的,比如
List<List<int>> array = new List<List<int>>();
List<int> item = new List<int>(new int[] { 3, 4, 5, 6 });
array.Add(item);
item = new List<int>(new int[] { 30, 40, 50, 60 散李});
array.Add(item);
int m = array[1][2];//此时的m即为50
public static void Main(string[] args)
{
int row = 2, column = 3;
int[,] a = new int[row, 桐旁column];
Console.WriteLine(a.Length);
row = 5;
握雀 column = 4;
a = new int[row, column];
Console.WriteLine(a.Length);
Console.WriteLine("二维数组的使用:");
for (int i = 0; i < row; i++)
{
for (int j = 0; j < column; j++)
{
Console.Write(a[i, j]+ " ");
局皮橡 }
Console.WriteLine();
}
Console.ReadLine();
}