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 does using do in c#?

592


Why is dll used?

674


What is the difference between structure and class in c#?

550


Is c# dictionary a hash table?

555


What are the different types of classes?

555






Explain the use of SN.exe

699


What is the difference between first and firstordefault?

529


What are annotations in c#?

606


What is the difference between final finally and finalize in c#?

547


What is the property of class?

668


What is a satellite assembly in c#?

649


What are the boolean data types in c#?

584


How to rotate an Image in C#?

668


What are assemblies?

611


What is use of console?

568