J
Jeff
..NET 2.0
Lets say I have this code:
public int test ()
{
string s = "hello world"
try
{
int i = 4;
return i;
}
finally { s = 'newbie' }
}
Will the finally block be executed each time or will the return statment in
the try block leave the method without executing the finally block??
It is no problem in this example above. But lets say I set a write-lock on a
table in a database and then hope the finally block will remove that lock,
despite I call a return in the try block
any suggestions?
Lets say I have this code:
public int test ()
{
string s = "hello world"
try
{
int i = 4;
return i;
}
finally { s = 'newbie' }
}
Will the finally block be executed each time or will the return statment in
the try block leave the method without executing the finally block??
It is no problem in this example above. But lets say I set a write-lock on a
table in a database and then hope the finally block will remove that lock,
despite I call a return in the try block
any suggestions?