I am trying to figure out how to control when my custom objects are collected by the Garbage Collector - I have found a lot of references to using IDisposable/Destructors to do this but every example has something like the following:
class Car
{
~Car() // destructor
{
// cleanup statements...
}
}
(http://msdn.microsoft.com/en-us/library/66x5fx1b.aspx)
What actually goes in the "Cleanup Statements"?
I want to be able to call CarInstance.Dispose() when my program is down with an instance of the object and have the GC clean up that specific instance - that way I won't have spikes in performance issues when the GC runs automatically and cleans up a bunch -
Let me know! William