与C ++不同，对C ++的调用"destructor" of C# object is not deterministic. It will only get called when the managed object finally gets garbage collected. The time of garbage collection is not deterministic. The IDisposable pattern gives you an opportunity to have deterministic clean up of an object. For managed objects and resources it doesn't matter, but for unmanaged resources, chance are that you'll want to guarantee that they are released and cleaned up.
If you implement the IDisposable interface in your class then the IDE should insert boilerplate code for you that indicates exactly what you should do and where. You then simply need to call the Dispose method of your type when you are finished with an instance, or create it with a using statement in the first place. That's how it's supposed to work and that's what you should do. Generally speaking, you would only need to call 收集 directly under very rare circumstances, e.g. you are replacing a large number of Image objects with new ones.