How to create background process / tray application
Hi,
I need to create an application which should search and capture some user specified files. this application should run as a background process or tray application. Do i have to write a windows service for this?
or how could i get this done??
Thanks a lot in advance.
Answers (9)
1 Well, the Dispose() method only cleans up unmanaged resources such as file handles, database connections etc. It doesn't remove the managed object (x) itself from memory.
The garbage collector (GC) does that when there are no longer any references to the object at a time of its choosing.
Generally speaking, the GC does a good job and you should not try to interfere with its operation. Apart from calling Dispose() if the object implements IDisposable, the only thing you should do is to set object references to null if they are no longer needed and they aren't about to go out of scope anyway as this might enable the GC to clean up the object more quickly.
However, you can force a collection to take place with the static GC.Collect() method and, if you're about to perform a critical operation where you cannot afford the GC kicking in in the middle of it, then you can call this method first.
Accepted 0 Thanks for the thorough explanation!