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 I have code like
try
{
return;
}
catch
{
return;
}
finally
{
return;
}

from which block will the value will be returned. and try
has been executed without any error.

Answer Posted / jens

It won't; that construction isn't allowed. You can't have a
return in the finally clause. Once that is removed there is
no problem, right?

Try this, call it from some code that displays the result
and then uncomment the //for...-line and run again.
private int WeirdTry()
{
int foo = 10;
int result = 4;

try
{
//for (int i = 0; i < 100; i++) result = 1 /
(foo - i);
return result;
}
catch (Exception ex)
{
MessageBox.Show("Exception " +
ex.InnerException);
return result;
}
finally
{ MessageBox.Show("finally ");}
}

/Jens

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the benefit of using interface in c#?

961


What are the return types in c#?

933


What is the use of parse in c#?

859


Is for loop faster than foreach?

971


What is dll hell, and how does .net solve it?

926


Why do we use stringbuilder in c#?

887


Can abstract class be instantiated c#?

901


Define satellite assembly in c#?

853


Can you pass parameters to destructors?

1009


How many types of namespaces available in version4?

902


What are the benefits of using the aggregate method in linq?

959


List the two important objects of ado.net and also list the namespaces that are commonly used in ado.net to aid in connection to a database.

875


What is the difference between interface and abstract class in c#?

876


Can int be null c#?

890


What is difference between private and protected in c#?

917