Solved

Finally clause

Posted on 2006-06-14
4
177 Views
Last Modified: 2010-04-16
If there's a return statement outside try/catch/finally block, is finally still executed?

Thanks
0
Comment
Question by:gromul
  • 2
  • 2
4 Comments
 
LVL 11

Expert Comment

by:Expert1701
ID: 16906956
Yes, in the case of,

  try
  {
    return;
  }
  finally
  {
  }

or,

  try
  {
  }
  finally
  {
  }

  return;

the finally block will be executed.
0
 

Author Comment

by:gromul
ID: 16907964
What about this?

return;

try
  {
  }
  finally
  {
  }

 
0
 
LVL 11

Accepted Solution

by:
Expert1701 earned 500 total points
ID: 16908106
In that case, no.  Neither the try, nor the finally blocks will execute.
0
 

Author Comment

by:gromul
ID: 16908150
Thanks
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
WKHTMLTOPDF - --disable-smart-shrinking not working 10 90
Printing 1 51
Please explain the parts of these 2 LINQ expressions 3 32
insert value of checklistbox checked 4 27
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question