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 ,
Comments
Post a Comment