return and finally

  • Thread starter Thread starter Steve B.
  • Start date Start date
S

Steve B.

Hi,

I I have in a code like this :

public void A()
{
try
{
DoSomething();
return;
}
catch
{
return;
}
finally
{
Clean();
}
}

When does the Clean() method is called if I have a return instruction in the
try block ?

Thanks,
Steve
 
it is the first thing that is called when the execution path leaves the try
catch block

HTH

Ollie Riches
 
Ahh :-) Once you exit the try block, unless an exception is thrown, in which
it's once case the appropriate catch block finishes.
 
Back
Top