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

How to parse a date time string?

1068


What is the difference between integer and double?

977


Explain the difference between “system.array.clone()” and “system.array.copyto()” in c#?

972


Why do we need encapsulation in c#?

1001


What is scope c#?

927


What's the difference between a static method and a non static method c#?

1059


What are extension methods and where can we use them?

937


In which order the destructor is called for an inherited class?

1033


What is entity framework c#?

911


What is difference between function and method in c#?

949


Why singleton class is sealed?

986


Why generics are used in c#?

1001


Is java better than c sharp?

1017


What are reflections in c#?

950


What is lock statement in C#?

1056