Reference Objects in sessions
if a list of objects are saved in the session, the session gets updated automatically when a new 开发者_JAVA百科object is added to the list due to objects declared as reference types.. why this is not the same case when removing an item from the list?
First of all, it depends on session state mode. Your thoughts would be for in-process mode or some other custom mode that would store objects in-memory.
In the other hand, removing an object from session state doesn't mean you killed it. It's just a collection of objects like any other (f.e. List).
Objects are destroyed and removed from memory by Garbage Collector.
You can read more about Garbage Collector in this MSDN article:
- http://msdn.microsoft.com/en-us/library/ms973837.aspx
精彩评论