In C#, the following “containers” hold reference or object itself for reference types?
Queue
Stack
Array
List
Vector
For example if I do the following:
Queue<MyItem> item = new Queue<MyItem>(100);
MyItem mit = new MyItem();
item.Enqueue(mit);
The reference of the mit is copied to item or the mit object itself has been moved to item memory location?
if I say
item = null;
it will not set all objects inside item to null. Am I right?
The Queue contains a reference to the items in contains. Setting the Queue to null will not affect the items themselves.