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 void method?

889


What is the wildcard character in sql?

974


Is arraylist thread safe?

835


What is a satellite assembly in c#?

943


What is the purpose of the integer parse method the decimal parse method?

1019


Which constructor is called first in c#?

881


What is .edmx file?

919


Explain the role of Garbage collector and its generations?

876


What is the delegates in c#?

858


Explain the difference between class and interface in .net?

812


What are properties in C#?

919


What is use of FormBoarderStyle Propertie

872


What is difference between arraylist and list in c#?

837


Explain dataset.acceptchanges method in .net?

891


Can we inherit partial class in c#?

870