You must use GetLength
method, not the Length
property.
The Length
property for a multi-dimensional array returns the total count of all the items in the array. The GetLength
method returns the number of size of a given dimension (where dimension is specified as a zero-based index).
So, arrHolidays.Length
will return 6.
Change for
loop to:
for (int i = 0; i < arrHolidays.GetLength(0); i++)
{
Console.WriteLine(arrHolidays[i, 0]);
}