Click here to Skip to main content
16,004,602 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Please can anyone tell me how to implement the garbage collector and use it in c#. Thanks in advance
Posted
Updated 25-Aug-15 1:51am
Comments
Philippe Mori 25-Aug-15 12:31pm    
If you don't how to do it, then you probably don't know when to use it anyway and what impact it can have...

1 solution

Use GC.Collect[^]


Note that there are very little good reasons to do this. The operation is costly, evaluating all objects for collection; it is blocking, making the rest of your program wait; and except for really resource starved systems makes no difference if the code is written respecting disposable interfaces.
 
Share this answer
 
Comments
CPallini 25-Aug-15 8:07am    
5.
Sinisa Hajnal 25-Aug-15 9:03am    
Thank you. You could vote too :)
CPallini 25-Aug-15 9:06am    
OOOOOOOPS, fixed. :-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900