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

Why static variables are used?

609


Why do we need indexer in c#?

652


Are cao stateful in nature?

550


Compare and contrast between the System.Array.CopyTo() and Clone()?

625


What is difference between variable and property in c#?

511






What is the lock statement in c#?

625


Name the two classes are required for implementing a windows service?

651


What is ado net in c#?

590


What is the purpose of c#?

627


How can we sort an array in c#?

592


Why c# is called c sharp?

541


Can you describe iuknown interface in short?

724


How to find the current application file path while runtime?

576


What is the use of functional interface?

573


What does get set mean in c#?

579