Answer Posted / vaidyanathan
By Dispose() method the object is marked for garbage
collection. But user can define a Dispose() method
identified by GC, only when the user implements the
IDisposable interface in the class. Once the dispose()
marks the object for deletion, the garbage collector, in
its subsequent collection cycle, collects the objects by
calling the respective Finalize() methods. So there is no
need for the user to write the Finalize() method. This is
the normal Process of Garbage collection.
At extreme cases user can force the garbage collection at a
specific time by calling GC.Collect() method. This should
be followed by GC.SuppressFinalize() method call to avoid
GC from calling Finalize() method on the same object once
again.
Is This Answer Correct ? | 5 Yes | 0 No |
Post New Answer View All Answers
Is everything an object c#?
What is a method signature in c#?
Write a sample code to write the contents to text file in c#?
Is class reference type c#?
What is a Command Object in C#?
Is string nullable c#?
Can I call a virtual method from a constructor/destructor?
What is the default value of decimal in c#?
Is null or empty in c#?
Which debugging tools you can use in the .NET ssSDK?
How to properly clean up excel interop objects?
Write a console application and implement the ternary operator to decide whether the age a user entered after being prompted is allowed to vote or not(given that only citizens between 18 and 120 years only inclusive can vote). Use exception handling for non-numerical input.
How does dependency injection work c#?
Define parsing? Explain how to parse a datetime string?
What is dll hell, and how does .net solve it?