I have one requirement in my C# project. I have to scan a files only for certain period of time and it will stop scanning after some hours. For continuous watching a file, I used FileSystemWatcher()
class and this class continuous will watch a files if any files renamed, created, deleted. Now, my requirement is stop a scanning files after some time. I started a StartWatcher()
method to start a FileSystemWatcher()
class. I got a time in sec. How will I call stopWatcher()
method after certain period of time.
Any quick idea ??
m_monitor.StartWatcher();
// code in C# so that I can call StopWatcher after some period of time.
m_monitor.StopWatcher();