Session.add

J

Jim McGivney

Session["Pram1"] = value1; and Session.Add["Pram1"] = value1;
Seem identical in function. When is it better to use one than the other.
Thanks,
Jim
 
S

S. Justin Gengo

Jim,

I believe they are identical.

It think it most likely that Session["Pram1"] and Session.Add["Pram1"] are
just overloads of the same functionality. One of them probably calls the
other. So it would be interesting to know which one calls which because
calling the actual method should be slightly faster.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
S

S. Justin Gengo

Jim,

After looking around for info on System.Web.SessionState.HttpSessionState
here's what I found:

When session is called:
Friend Sub New(ByVal id As String, ByVal dict As SessionDictionary, ByVal
staticObjects As HttpStaticObjectsCollection, ByVal timeout As Integer,
ByVal newSession As Boolean, ByVal isCookieless As Boolean, ByVal mode As
SessionStateMode, ByVal isReadonly As Boolean)
Me._id = id
Me._dict = dict
Me._staticObjects = staticObjects
Me._timeout = timeout
Me._newSession = newSession
Me._isCookieless = isCookieless
Me._mode = mode
Me._isReadonly = isReadonly
End Sub


When Session.Add is called:
Public Sub Add(ByVal name As String, ByVal value As Object)
Me._dict.Item(name) = value
End Sub

Without further analysis I would guess that Session.Add should be faster...

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,279
Latest member
LaRoseDermaBottle

Latest Threads

Top