G
Guest
Hi all,
The variables declared inside try block cant be accessed inside its
corresponding finally block. When I used to explain finally concept to anyone
I would usually tell them (briefly) that the finally block is existing there
cuz of the logic inside try block, if try is not there finally wont be there.
If try and finally are so closely related than finally should share the scope
of try. Please explain the rational behind this scope restriction.
I wanted to do
try
{
string tmp = this.Text;
...
}
catch{}
finally
{
this.Text = tmp;
}
but since I cant access try scope variable in finally sshould I move the
settings outside them like:
string tmp = this.Text
try ..
finaly {}
this.Text = tmp;
Thanks & Regards,
Abubakar.
http://joehacker.blogspot.com
The variables declared inside try block cant be accessed inside its
corresponding finally block. When I used to explain finally concept to anyone
I would usually tell them (briefly) that the finally block is existing there
cuz of the logic inside try block, if try is not there finally wont be there.
If try and finally are so closely related than finally should share the scope
of try. Please explain the rational behind this scope restriction.
I wanted to do
try
{
string tmp = this.Text;
...
}
catch{}
finally
{
this.Text = tmp;
}
but since I cant access try scope variable in finally sshould I move the
settings outside them like:
string tmp = this.Text
try ..
finaly {}
this.Text = tmp;
Thanks & Regards,
Abubakar.
http://joehacker.blogspot.com