Single Dimensional arrays

  • Thread starter Thread starter Sim
  • Start date Start date
S

Sim

Hi,

I come from a C background and I heard that in C# single dimensional
arrays are stored in a tree structure internally? Is that true? I know
that's true for jagged arrays but I'm not sure about single dimensional
arrays. Could someone clear this out for me because it's important I
know all the aspects on arrays before I implement what I need to. Thanks

Sim
 
I come from a C background and I heard that in C# single dimensional
arrays are stored in a tree structure internally? Is that true?

No, the items in a single dimensional array are stored sequentially in
memory, like an array in C.



Mattias
 
That's just wrong. C# arrays are contiguous arrays internally. Where did you
hear this from?

Bruno.
 
Sim said:
What about jagged? They're in a tree, right?

Well, it depends what you mean by a tree. A jagged array is just an
array of arrays. Each array itself is stored sequentially in memory,
but the contents of each element is a reference to another array (or
null).
 
Back
Top