I have an array of array wich all have the same length.
Which syntax is to be preferred :
multidimensional : string[,] names = new string[5,4];
or
jagged : string[][]names = new string[5][4];
Or is it, in this case just a matter of style?
I searched this site and I read among others http://msdn.microsoft.com/en-us/library/aa288453(VS.71).aspx

Recommended Answers

All 3 Replies

Look, my friend Danny, they're different
Array of Array == one-to-many, imagine every cell in the above array has all cells in the below array..
I know, I can describe it but I'll draw it for you...

I attached the images, I hope it clarifies...

commented: Very intructive! This man knows what he his doing! +4

Thanks Ramy!
I see this more clearly now!
I understand the concept of jagged arrays. But from your drawing I can see there is always a difference between multidim and jagged.
Thank you for that clarification.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.