?
Solved

Finally clause

Posted on 2006-06-14
4
Medium Priority
?
186 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

777 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