The dispose () method you use is used to explicitly free unmanaged resources (files, streams, descriptors, etc.) to which your object contains a link.
The idea is that you release these resources as soon as possible by calling the dispose method. The dispose () method will not IMMEDIATELY start garbage collection on your object, but rather free up resources and let the garbage collector do its job when convenient.
source
share