Hi,
Can anyone tell me how to cast this bit of code back to a Car type? In the example I know its a type Car but what if I didn't?
The reason I ask is because I'm writing a little debug method which lists all the Session variables by looping through Session.Contents and therefore I can work out the type, but how use it when casting? (the line Car c = Session[sn] as Car; )
Car car = new Car();
car.Model = "Golf";
car.Cc = 1600;
Session["Car"] = car;
Debug.Print(Session["Car"].GetType().ToString());
object st = Session["Car"].GetType();
String sn = st.ToString();
Debug.Print(sn);
Car c = Session[sn] as Car;
...
Go to the complete details ...