Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


If we write return statement in finally block will it works
fine or throws any error?

Answers were Sorted based on User's Feedback



If we write return statement in finally block will it works fine or throws any error?..

Answer / somnath nanekar

it throws an error....
but dont worry d c# users...
it dont allow u to write return in finally block......

Is This Answer Correct ?    11 Yes 0 No

If we write return statement in finally block will it works fine or throws any error?..

Answer / rakesh

dont give false answers...
it will give error.Compiler Error CS0157

Is This Answer Correct ?    16 Yes 6 No

If we write return statement in finally block will it works fine or throws any error?..

Answer / avijitc

it wil give error those whoe are telling wrong dont know
anything

Is This Answer Correct ?    11 Yes 5 No

If we write return statement in finally block will it works fine or throws any error?..

Answer / avinash kumar

We can not write any type of return statement inside the
finally block...The reason behind it,finally is block
should have to execute in any case.Return statment is fine
when no exception is generated or generated exception is
properly catched,in these two cases control can easily go
back to caller of method or a method can able to return a
valid datatype..
But what happen when an exception is
generated and is not caught,in this case also finally block
will exectute.After the execution of finally block the
control should goto the Runtime environment,means control
should should go away from the execution.But keeping the
return statement inside finally block,in this case
execution plan force the runtime environment to give the
control to the caller of the method.
So for this reason we
can not put any type of return statement inside finally
block.Because complier checks all the possiblities....

Is This Answer Correct ?    8 Yes 2 No

If we write return statement in finally block will it works fine or throws any error?..

Answer / 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

If we write return statement in finally block will it works fine or throws any error?..

Answer / zahid nawaz

Return statement will ork fine b/c i like other block just
with compulsory execution .

Is This Answer Correct ?    1 Yes 10 No

If we write return statement in finally block will it works fine or throws any error?..

Answer / sri4u_926

If we write return statment in the finally block it works
fine coz finally is compulsary exe block.

Is This Answer Correct ?    4 Yes 14 No

Post New Answer

More Dot Net Framework Interview Questions

What is presentation framework?

0 Answers  


What are non action methods in mvc?

0 Answers  


If u have an Empty Xml file and u have to bind dataset data to empty xml file? if u have an empty dataset u have to bind xml file data to it?

0 Answers  


If we write return statement in finally block will it works fine or throws any error?

7 Answers   Kanbay,


Is CLR is compiler or Interpreter

3 Answers   L&T,


What is asp net framework?

0 Answers  


What is MVVM design pattern?

0 Answers  


Which are the abstract classes available under system.xml namespace

1 Answers  


What is the CLS

1 Answers  


How route table has been created in ASP.NET ASP.Net MVC?

0 Answers  


What is the benefit of entity framework?

0 Answers  


Is any files are generated,when we are adding the web reference to the web service?

1 Answers  


Categories