Hi, I have a question: if I declare a class variable in a Form, for example string cVar = “value”, will it be reassigned every time the Form is opened or will it become a session variable?
Example:
public partial class Test : Form
{
string cVar = “value”;//Is this destroyed every time the Form Test is closed?
public Test ()
{
InitializeComponent();
}
}
Thank you
Hi Francesco,
The variable is going to be assigned whenever you create a new form, it will not become a session variable!
To use session variables, please consider using Application.Session[“cVar”] = “value”, or, for a more advanced implementation, please consider looking at SessionReference .
Best Regards,
Alaa
Please login first to submit.