If we write return statement in finally block will it works
fine or throws any error?
Answer Posted / mahesh kotekar
Answer Is NO. We cannot have return in finally block...
we get the following error.
Control cannot leave the body of a finally clause
returns void, a return keyword must not be followed by an
object expression
try
{
First.DoSomething1();
First.DoSomething2();
}
catch (Exception)
{
throw;
}
finally
{ return 0; }
| Is This Answer Correct ? | 5 Yes | 3 No |
Post New Answer View All Answers
What is oauth in web api?
What are the new enhancements done in default project template of asp.net mvc 4?
Do you know about the new features in ASP.Net MVC 4 ?
What does a viewmodel do?
Explain Sections is ASP.Net MVC?
Which approach provides better support for test driven development - asp.net mvc or asp.net webforms?
Possible ways to prevent xss attacks on mvc application?
Can you use Razor code in Javascript in ASP.Net MVC?
Does windows 10 need .net framework?
What is object service? : Entity framework
which are the key concepts of entity data model?
What is managed extensibility framework?
What is session state management?
How to use multiple submit buttons in asp.net mvc?
Explain what languages does the .net framework support?