c# - Storing and retrieving multiple values in a single session -


i know there topics similar heading, kinda different.

first, in order store multiple values in single session, have use list whereas store list values in session, right ?

if so, when want add value list, in session, retrieve list session , add value. need assign list session every time have added/removed value list? or ,by default, gets automatically updated in session when manipulate assigned @ first in session , after that.

update: providing sample code of question

public void assignnewid(int currentid) {     if(session["usersid"] == null)     {         session["usersid"] = new list<int>();     }      if(currentid != null)     {         var list = (list<int>)session["usersid"];         list.add(currentid);          // should hereby assign list         // session like:         // session["usersid"] = list;         // or gets automatically updated in session default ?     } } 

list reference type storing reference session updated if object gets updated ,

session gets updated reference type


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -