次の配列があります。
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'
この問題を解決する方法を教えてください。