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
In Server how to check whether model has error or not in ASP.Net MVC
Where are the routing rules defined in an asp.net mvc application?
How we can handle the exception at controller level in ASP.Net MVC?
What are the new enhancements done in default project template of asp.net mvc 4?
What are actions in asp.net mvc?
What is MVVM design pattern?
What is meant by viewdata?
What are the two ways to add constraints to a route?
What are the components of the .net framework.
What happens when I install the .net framework 3.0? How can I upgrade if I already have the .net framework 2.0 installed?
Can we have enum in entity framework?
What is the greatest advantage of using asp.net mvc over asp.net webforms?
What are ajax helpers in mvc?
sql related question (outer join, left, right etc) array vs hashtable CRL sqldatareader vs dataset what is WPF, WCF, compare to WinForms Webservices Asp.net MVC vs WebForms?
Is the following route definition a valid route definition? {controller}{action}/{id}