Memory allocation for collections in .NET

Posted by Yogendra on Stack Overflow See other posts from Stack Overflow or by Yogendra
Published on 2010-06-10T20:06:30Z Indexed on 2010/06/10 20:12 UTC
Read the original article Hit count: 197

Filed under:
|
|

This might be a dupe. I did not find enough information on this.

I was discussing memory allocation for collections in .Net. Where is the memory for elements allocated in a collection?

List<int> myList = new List<int>();

The variable myList is allocated on stack and it references the List object created on heap.

The question is when int elements are added to the myList, where would they be created ?

Can anyone point the right direction?

© Stack Overflow or respective owner

Related posts about c#

Related posts about collections