Session.Add method - what if called multiple times with the same k

G

Guest

I wonder what is happening if you subsequently use the session.add method
with the same key, but different values.

e.g. if I do;
session.add("MyVar", "a")
session.add("MyVar", "b")

then; session("MyVar").tostring will return "b"

Is the value you are adding ("b") simply replacing the olde value ("a")
If so, should the name of the method then not be something like session.set,
because you are not actually adding anything.

Can't find anything about this in the documentation. Some explaination is
appreciated.
 
V

Vadivel Kumar

Hi,

I believe it is because of MS wants to reduce the number of
properties/methods etc.,
and It makes sense when assuming that Session is a memory area ( like a
container)
where you will add up all your values. "Set" sounds to be setting some thing
with determined manner.

Hope, this makes sense :)

Cheers!
 
Joined
Dec 16, 2011
Messages
1
Reaction score
0
We can add more session with same key value

Hi ,

I was also same doubt like this. i have implemented this scenario in my client application. it is working fine. So
:thrasher::thrasher::thrasher:

Regards

Saravanakumar T, M.M.Patti Coimbatore.



Hi,

I believe it is because of MS wants to reduce the number of
properties/methods etc.,
and It makes sense when assuming that Session is a memory area ( like a
container)
where you will add up all your values. "Set" sounds to be setting some thing
with determined manner.

Hope, this makes sense :)

Cheers!

"Martin" <[email protected]> wrote in message
news:[email protected]...
>I wonder what is happening if you subsequently use the session.add method
> with the same key, but different values.
>
> e.g. if I do;
> session.add("MyVar", "a")
> session.add("MyVar", "b")
>
> then; session("MyVar").tostring will return "b"
>
> Is the value you are adding ("b") simply replacing the olde value ("a")
> If so, should the name of the method then not be something like
> session.set,
> because you are not actually adding anything.
>
> Can't find anything about this in the documentation. Some explaination is
> appreciated.
 

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,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top