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

Why we use anonymous methods in c#?

938


What is a boolean c#?

890


what is .NET framework architecture ??

2006


How to exclude a property from xml serialization?

1011


What are the different states of a thread?

922


What is lastindexof c#?

852


When a Static Constructor is called in a Class?

1035


Write one code example for compile time binding and one for run time binding? What is early/late binding?

1018


How do I do implement a trace and assert?

974


What is console read in c#?

891


How can you force derived classes to provide new method implementations for virtual methods?

903


What tool we have to use to install assembli in gac folder.

900


Is an array an object c#?

931


Between windows authentication and sql server authentication, which one is trusted and which one is untrusted?

970


Do loops c#?

879