you can have
try
{
.......
.......
}
catch(C1)
{
......
}
catch(C2)
{
.......
}
finally
{
}
yes you can have the entire block within a switch brach... but then make
sure the catch if you include any and the finally if you add that as well
are within the same branch
if you want a global try catch finally
try placing calling method within try block and catch the exception and your
finally block
try
{
callFuncitonWithSwitch()
}
catch(c1)
{
}
catch(c2)
{
}
finally
{
}
the finally block should be associated with a corresponding try block... so
you cant have a try at one place and finally at a totally irrelevant
place...
and finally if the code execution never enters try... it never goes through
the finally either...
--
Regards,
HD
"Brian" <an*******@discussions.microsoft.com> wrote in message
news:02****************************@phx.gbl...
Is it possible to have more than one try/catch/finally
block within a method? Also, if the code never enters the
try block of code, is the finally block executed? I have
a try block in a branch of a switch statement and I only
want the finally to execute if the branch of the switch
statement is executed.