using System; // For the Console class. namespace DemoTypes { static class ArrayMultiDimensionsDemo { public static void DoDemo() { Console.WriteLine("\nArrayMultiDimensionsDemo"); Console.WriteLine("------------------------------------------------------"); int[,] rect = new int[5, 5]; int[][] jagged = new int[5][]; for (int i = 0; i < rect.GetLength(0); i++) { for (int j = 0; j < rect.GetLength(1); j++) { Console.WriteLine("rect[" + i + "," + j + "] is " + rect[i, j]); } } for (int i = 0; i < jagged.Length; i++) { Console.Write("For jagged[" + i + "], how many elements would you like? "); int num = int.Parse(Console.ReadLine()); jagged[i] = new int[num]; } for (int i = 0; i < jagged.Length; i++) { for (int j = 0; j < jagged[i].Length; j++) { Console.WriteLine("jagged[" + i + "][" + j + "] is " + jagged[i][j]); } } } } }