Wednesday, 18 September 2013

Relationship between return keyword and finally keyword in c#

Relationship between return keyword and finally keyword in c#

i want to find out that the relationship between "return" and "finally"
keywords. what is the execution order and what happens when exception
occurs and return keyword is called after code block does some stuff, if
there is two nested finally blocks as shown below,
try
{
try
{
}
catch (Exception)
{
//do some stuff
return;
}
finally
{
}
}
catch (Exception)
{
}
finally
{
}

No comments:

Post a Comment