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

Is comparator a functional interface?

868


What is expression tree in c#?

914


How more than one version of an assembly can keep in same place?

962


explain the three services model commonly know as a three-tier application.

982


What is static noise?

904


How can I produce an assembly?

1031


How do I declare a pure virtual function in c#?

981


In how many ways you can overload a method?

1057


Why is it not a good idea to use empty destructors?

1032


What is a Command Object in C#?

1022


Can you specify nested classes as partial classes?

969


In .Net, what is an assembly? Also explain the type of assembly.

902


What is msil, and why should developers need an appreciation of it if at all?

1045


What is the difference between static and private constructor in c#?

1001


What is difference between struct and class in c#?

909