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
Do I need microsoft .net framework?
What is viewdata?
What is the advantage of mvc?
What is the domain object?
what is more complex to implement property, methods or event? how can I define criteria to compare the difficulty of implementation between them? for example the number of methods wanted to implements property is 2 methods. how many methods I need it to implements events?
What is the importance of NonActionAttribute?
What are differences between entity framework and l2s? : Entity framework
Which filter executes first in an asp.net mvc application?
Explain the advantages of asp.net mvc over asp.net?
What are html helpers in asp.net mvc?
What is managed extensibility framework?
Can you Write the GC(Garbage Collector) Algoritham in .NET? (But not Explination of Working of GC).
How can I return string result from action in asp.net mvc?
Explain what platforms does the .net framework run on?
What are Validation Annotations?