If by "your application shuts down" you mean the process is terminating, then you technically don't need to do anything. Your process is terminating and the OS is going to free up those resources.
I imagine their could be some obscure corner cases where some component could create some type of file or other resource and if Dispose
is not called, that won't necessarily be cleaned up, even if your process terminates.
I'd like to give an example of this, albeit this is a bizarre corner case. Let's say you reference and use a component in your code. When you create and use this, it creates a 2GB file on your machine. Now let's take it a step further and say that this component, actually closes the file handle itself accessing this 2GB file sometime during it's use, due to a bug or just bad design. Now the Dispose
method on this object cleans up this file, but it is not well-documented. Essentially, missing the Dispose
call to this will leave a file on the machine. This is definitely a corner case and won't cause your machine to "leak" anything, but you do have a 2GB file just sitting there.
That being said - the best practice is to call Dispose
when you are deterministically done with your resource(s). You could call a method on your Singleton - let's say Cleanup()
- that can run when you are shutting down.