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 are differences between entity framework and l2s? : Entity framework
what is csdl?
In .net compact framework, can we free memory explicitly without waiting for garbage collector to free the memory?
Does windows 10 need .net framework?
How would you deploy your old applications with .net framework 4.0? Are the old applications compatible?
explain lazy loading, eager loading, and explicit loading?
When will the .net framework 3.0 be released?
mention what is the difference between ado.net and classic ado?
Explain the difference between viewbag and viewdata in mvc?
what do you mean by table-per-type?
Is entity framework slow?
How we can add the css in mvc?
What is the role of the jit compiler in .net framework?
How we can invoke child actions in ASP.Net MVC?
What is the need of Action Filters in ASP.Net MVC