Wednesday, June 29, 2022 12:11

Table of contents >> Arrays > Arrays of arrays

Arrays of arrays

C# allows us to have arrays of arrays, which we call jagged arrays. An array of arrays is basically an array in which each row is actually another array on its own.

This is an example of declaration for an array of arrays:

and this is how we initialize it:

Also, the arrays of the array can be one dimensional or multi-dimensional arrays, like we learned:

Finally, getting or setting the elements of an array of an array (lol, that sounds so complicated 😐 ):

Most of the times, arrays of arrays won’t be of a real use to you, there are simpler ways of doing this. However, it is good to have a vague idea in a corner of your mind about them, just in case you ever encounter a situation that would really require this concept.

Tags: ,

Leave a Reply



Follow the white rabbit