Can we have Return Statement in Finally Block?

 Posted by vishalneeraj-24503 on 11/28/2013 | Category: C# Interview questions | Views: 8561 | Points: 40

No,we can not write any Return Statement inside Finally Block.It will throw an error at the Complie-Time saying that:-

"Control cannot leave the body of a finally clause"

Meaning that finally block is only used for Releasing Objects or Calling any function other than Returning Some Value.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response