.Net C# Development

C# Arrays and Jagged Arrays

int[] simplearray = new int[3] {1,2,3 }; //Sigle Dimension array
            int[,] multiarray = new int[3, 3] { {1,2,3 },{ 4,5,6},{ 7,8,9} }; //multi Dimension array
            int[][] arr = new int[2][]; //Jagged Array
            arr[0] = new int[] {12,23 };
            arr[1] = new int[] {122,22 };
            foreach(var item in arr) //Display jagged array
            {
                foreach(var subitem in item)
                {
                    Console.WriteLine(subitem);

                }
            }

Leave a Reply

Your email address will not be published. Required fields are marked *