If they are not related, then I would store them in seperate session
variables.
If they're related....lets say you want to store the
EmpID (int) and EmployeeLoginName (string), I would create a mini wrapper
object.
[Serializable]
public class EmployeeLoginInfo
{
private int _empID = 0;
private string _employeeLoginName = string.Empty;
public EmployeeLoginInfo( int empID , string employeeLoginName )
{
_empID = empID;
_employeeLoginName = employeeLoginName;
}
public int EmpID { { return _empID;}}
public string EmployeeLoginName { get { return _employeeLoginName;}}
}
and then I would session that mini object.
Delimited String << Heck No
Array << Heck No
That's my vote.
To me, using the mini object means I only have to pay the casting price
once.
And my code make more sense, because I don't have a bunch of disjoint
properties flying all over the place.
You can check this blog entry as well:
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!151.entry
rodchar said:
hey all,
can someone please tell me if there's a big difference among the
following:
i want to store a string and an int in session.
is it better to store it like:
1. delimited string (i.e. session["test"]="test1" + ";" + 1
2. in an array
3. or 2 separate sessions
how would each one rate?
thanks,
rodchar