我有以下数组:
string[] list1 = new string[2] { "01233", "THisis text" };
string[] list2 = new string[2] { "01233", "THisis text" };
string[] list3 = new string[2] { "01233", "THisis text" };
string[] list4 = new string[2] { "01233", "THisis text" };
string[][] lists = new string[][] { list1, list2, list3, list4 };
我正在尝试使用以下代码查看数组值:
for (int i = 0; i < lists.GetLength(0); i++)
{
for (int j = 0; j < lists.GetLength(1); j++)
{
string s = lists[i, j]; // the problem is here
Console.WriteLine(s);
}
}
Console.ReadLine();
问题lists[i, j];
带有下划线并导致此错误消息:Wrong number of indices inside []; expected '1'
你能告诉我如何解决这个问题吗?