ASP.NET 'Session.Remove(key)' v/s 'Session(key) = nothing'

Posted by Whiskey-Tango-Foxtrot on Stack Overflow See other posts from Stack Overflow or by Whiskey-Tango-Foxtrot
Published on 2010-06-02T14:07:09Z Indexed on 2010/06/02 14:14 UTC
Read the original article Hit count: 186

Filed under:
|
|

I've seen developers use two approaches when they are done with a session object.

1) Session.Remove(key)

2) Session(key) = nothing

What is the better approach of the two above? Does Session.Remove dispose the object stored automatically?

Does the second approach depend on the garbage collector to actually free up the memory?

Thanks.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about session