I have a class containing two list prop and i want those list element to be in Session. So i did tried the below code. but i didn't how to get the asked property and skipped property of each person object.
class Interrogation
{
//list contains asked questions
private List<int> _asked = new List<int>();
public List<int> asked
{
get { return _asked; }
set { _asked = value; }
}
//list contains skipped questions
private List<int> _skipped = new List<int>();
public List<int> skipped
{
get { return _skipped; }
set { _skipped = value; }
}
}
protected void UploadBtn_Click(object sender, EventArgs e)
{
testmulList();
readSession();
}
protected void testmulList()
{
Interrogation person1 = new Interrogation();
person1.asked.Add(8);
person1.skipped.Add(7) = 67;
Session["person1"] = person1;
}
protected void readSession()
{
var output = Session["person1"];
Debug.WriteLine(output);
}
When i tried Debug.WriteLine(output) i did not get any output.
Question:
1. How do i read the separate prop from the session object
2. What if i create a object list and perform the same. again leads to question 1.