using System;
namespace _7лаб
{
class Program
{
static void Main()
{
const int n = 3;
string[][] ch = new string[n][]
{
new string [] {"один", "два", "три"},
new string [] {"четыре", "пять"},
new string [] {"шесть", "семь", "восемь", "девять"}
};
for (int i = 0; i < ch.Length; i++)
{
for (int j = 0; j < ch.Length; j++)
{
Console.Write($"{ch[i][j],6}");
}
Console.WriteLine();
}
Console.ReadKey();
}
}
}
Строка Console.Write($"{ch[i][j],6}");
вызывает исключение. В чем проблема?
ch
- три элемента, а в массивеch[1]
- два.