if a list of objects are saved in the session, the session gets updated automatically when a new 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?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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: