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 client wins and store wins mode in entity framework concurrency?
What is controllercontext?
What are the difference between asynchronous controller implementation between asp.net mvc 3 & asp.net mvc 4?
Possible ways to prevent xss attacks on mvc application?
Explain ASP.NET MVC Identity and Security?
What is viewdata?
Can you explain model, controller and view in mvc?
what is dot net? what is use dot net? what is benifit of dot net?what is vb dot net? what is ado dot net? what is c#?
What are Scaffold templates in ASP.Net MVC?
What is the "helperpage.isajax" property?
what is use of entitydatasource control?
What is meant by viewdata?
What is objectcontext? : Entity framework
What is object service? : Entity framework
Define the core components of an ASP.NET MVC application?