The Jagged Array in simple terms is an array of array . Below is an example of the Jagged Array in C#.
What is Jagged Arrays in C# ?
using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Linq; using System.Net; namespace AbundantCode { internal class Program { // What is Jagged Arrays in C# ? private static void Main(string[] args) { int[] array1 = { 10, 45, 734 }; int[] array2 = { 986, 233, 233 }; int[][] MainArray = new int[2][]; MainArray[0] = array1; MainArray[1] = array2; foreach (var item in MainArray[0]) Console.WriteLine(item); Console.ReadLine(); } } }
Leave a Reply