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
How many kinds of elements an array can have?
Is multiple inheritance possible in c#?
Does unity require coding?
What are circular references? How garbage collection deals with circular references.
How do I calculate relative time?
What is action c#?
Why are strings immutable in c#?
What is the use of readkey in c#?
Explain “static” keyword in c#?
What is the difference between icomparer and icomparable in c#?
Is c# a keyword?
In which format you can pass the value in the sleep function?
What is the difference between as and is operators in c#?
what is the difference between the debug class and trace class?
What is default method in c#?