C
craig
This may sound like a dumb question, but I am hoping someone might comment
on it....
Consider the following method (assuming that Form1 is a class derived from
System.Windows.Forms.Form) :
private void MyMethod()
{
int i = 1;
Form1 myForm = new Form1();
myForm.Show();
}
Both of the variables, i and myForm, are local variables that should go out
of scope when the method is finished executing. But the myForm variable
continues to live on. Is this correct? Why is the scope of form variables
different than the scope of other types?
on it....
Consider the following method (assuming that Form1 is a class derived from
System.Windows.Forms.Form) :
private void MyMethod()
{
int i = 1;
Form1 myForm = new Form1();
myForm.Show();
}
Both of the variables, i and myForm, are local variables that should go out
of scope when the method is finished executing. But the myForm variable
continues to live on. Is this correct? Why is the scope of form variables
different than the scope of other types?