Chr*_*rén 1 c# directory filesystemwatcher
基本上,我有这个程序检查目录中的更改,如果有任何内容被复制或创建到所述目录中,则会发生一些事情.这很好用.但是,如果在程序启动时监视目录不为空,我希望代码能够触发,这可能吗?如果是这样,怎么样?
检查自己:
if (Directory.GetFiles(yourPath).Length != 0)
{
//trigger your action
}
//else?
//set up the FileSystemWatcher
Run Code Online (Sandbox Code Playgroud)