Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
基本上,我有这个程序可以检查目录中的变化,如果有任何东西被复制或创建到所述目录中,就会发生一些事情。这工作正常。但是如果程序启动时监视的目录不为空,我希望代码触发,这可能吗?如果是这样,怎么做?
只需检查自己:
if (Directory.GetFiles(yourPath).Length != 0) { //trigger your action } //else? //set up the FileSystemWatcher