How can you clean up objects holding resources from within
the code?

Answer Posted / nagasaichand

The recommended practice is to implement both Finalize as
well as Dispose methods on an object which needs to clean up
unmanaged resources. The Finalize method would serve as a
backup mechanism in the event that the Dispose is never
called. The garbage collector would perform the object
finalization and prevent a permanent leak of the unmanaged
resource.

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What happens if you add duplicate elements to a set?

504


Which one is trusted and which one is untrusted?

517


What problem does Delegate Solve?

568


Does c# support properties of array types?

516


What is a dictionary in c#?

498






In a single .NET DLL how many classes it contains?

518


Can int be null c#?

529


Explain about c# language.

603


Can derived classes have greater accessibility than their base types?

547


What are virtual destructors?

509


Are c# objects passed by reference?

467


What is the difference between C# 3.5 and C# 4.0?

542


What is difference between iqueryable and ienumerable in c#?

459


What is difference between a constant and read-only in C#?

535


Why do we use classes?

504