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 we write a goto or a return statement in try and catch
block will the finally block execute?

Answer Posted / uday

The statements after goto in try block wont be executed.
And Finally block also get executed.
static void Main(string[] args)
{
int a, b,c;
a = 10;
b = 0;
try
{
goto A;
c = a + b;
Console.WriteLine(c);
}
catch (Exception e)
{
Console.WriteLine("In parent exception Catch" +
e.Message);
}
finally
{
Console.WriteLine("In finally block");
}

A:
Console.WriteLine("at goto label");

Console.Read();

}

The output is:
In finally block
at goto label

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the default value of singleordefault?

1006


Why var is used in c#?

1010


Why do we use 0?

972


What is the use of delegate?

1019


What is the purpose of abstract class in c#?

976


Define satellite Assembly?

1062


What are the different types of classes in c#?

993


What is array class in c#?

895


What is cookies in c# asp net?

997


How does inheritance work in c#?

1178


What is func delegate in c#?

995


Is c# code is managed or unmanaged code?

1124


What is default constructor c#?

1008


What are the types of assembly available

991


What do you mean by serialization in .NET?

1080