I was reading an article about array vs list, and the author says that an array is worse than a list, because (among other things) an array is a list of variables, but to me a list is also a list of variables. I mean, I can still do list[3] = new Item()
.
Actually, I have always somehow saw a List<T>
like a wrapper for an array that allows me to use it easily without caring about handling its structure.
What are the internal differences between a T[]
and a List<T>
in terms of heap/stack memory usage?