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

Answer Posted / linto

For releasing unmanaged related objects from Garbage
collector.While,exception happen,the process flow may be
change.At that situation unmanaged objects like database
connection etc should be close.For that purpose we are
using finally block in try catch block.But,Idisposable is
better in the case of efficiency.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you mean by thread safe in c#?

465


What is difference between C# and VB.NET?

512


Is string nullable in c#?

453


What is part of a method signature in c#?

462


What is string literal in c#?

523






What is enumerable in c#?

472


What is delegate in c#?

541


What is a decimal c#?

467


What is stringwriter c#?

433


what is IDisposal interface,IComparable,IEquatable,IFormatable

527


What is the default modifier for class in c#?

509


What is the difference between abstract and abstraction?

436


Explain how to use an extender provider in the project.

480


What’s a strong name?

521


Is datetime value type c#?

479