Would watching a file for changes or redundantly querying that file be more efficient?

Posted by badpanda on Stack Overflow See other posts from Stack Overflow or by badpanda
Published on 2010-06-08T21:24:16Z Indexed on 2010/06/08 21:42 UTC
Read the original article Hit count: 324

I am wondering whether watching a file/directory for changes using the FileSystemWatcher class is extremely memory intensive. I am developing a desktop application in C# that will be running behind the scenes continuously on low-performance computers, and I need some way of checking to see if various files have changed. I can think of a few solutions:

  1. Watch the directories using FileSystemWatcher.
  2. Run a timed thread on an interval that goes through and manually checks this.
  3. Check manually every time the actionhandler thread runs (the program will occasionally do something, on an action).

Any suggestions?

Thanks!

badPanda

© Stack Overflow or respective owner

Related posts about c#

Related posts about Performance