Search For
Flagging a Snippet, takes the snippet to Moderator Attention;


0
You can declare and use jagged array like below,
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace ForgetCode
{   
    public class MainClass
    {
        public static void Main()
        {
            //General declaration
            int[][] numbers = new int[2][] { new int[] { 2, 3, 4 }, new int[] { 5, 6, 7, 8, 9 } };

            //Omitting the size
            int[][] numbers2 = new int[][] { new int[] { 2, 3, 4 }, new int[] { 5, 6, 7, 8, 9 } };

            // Direct usage of new inside the array
            int[][] numbers3 = { new int[] { 2, 3, 4 }, new int[] { 5, 6, 7, 8, 9 } };
        }
    }
}


Vote! You feel this code is working like charm ? Go a head Login and Press up arrow.
Didn't work ?, press down arrow and let us know the error in comments

Comments