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 lazy loading in entity framework?
What is oauth in web api?
what is conceptual model?
Is .net framework going away?
What are the main features of asp.net mvc 4 used by asp.net web api?
what is .edmx file and what it contains?
How to change the action name in mvc?
Explain what is asp.net mvc?
What are the benefits of .net framework?
What is action methods in web api?
Which version of the common language runtime (clr) does the .net framework 3.0 use?
What is Area in ASP.Net MVC?
What is Separation of Concerns in ASP.NET ASP.Net MVC?
What is asp net framework?
What is net framework 3.0 ?