Why do we need a finally block in try catch block while
handling exceptions

Answer Posted / vijay kumar inumella

finally block will be executed irrespective of whether
the exception occured or not.
finally block is generally used to close the database
connections and to dispose the session objects etc.

Is This Answer Correct ?    12 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Are arrays immutable c#?

732


What is the extension of c# file?

677


In which format you can pass the value in the sleep function?

762


What is array and its types in c#?

729


What is the purpose of escape sequence?

827


What is unsigned int?

716


What's the difference between an integer and int?

778


Why reflection is used in c#?

714


what will be the output of the given below coding. using System; public class Exercise { static void OddNumbers(int a) { if (a >= 1) { Console.Write("{0}, ", a); a -= 2; OddNumbers(a); } } public static int Main() { const int Number = 9; Console.WriteLine("Odd Numbers"); OddNumbers(Number); Console.WriteLine(); return 0; } }

3884


What is the use of console readkey in c#?

712


Can a string be null c#?

693


Why do we still see so much non-oo code written in c# today?

718


What is a void c#?

697


What is the base class of all classes in c#?

755


What is Covariance and contravariance in C#?

788