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


Please Help Members By Posting Answers For Below Questions

What is the 'page life cycle' of an ASP.NET MVC?

601


What is entitytype? : Entity framework

526


Do I need microsoft .net framework?

544


What is the difference between renderaction and renderpartial?

609


What is entity framework? : Entity framework

558






Can you Write the GC(Garbage Collector) Algoritham in .NET? (But not Explination of Working of GC).

1795


What is the use of view model in asp.net mvc?

676


I want ask from plz smaple example code for Biztalkk server

1704


What is poco proxy? : Entity framework

551


how do you query in entity model when the result has a join from from different database other than the entity model?

552


How to update one of my table in database at 4pm every day how it is possible?

543


What is the need of Action Filters in ASP.Net MVC

566


Which are the important namespaces used in mvc?

710


Which .net framework is installed?

496


How we can register the Area in ASP.Net MVC?

566