I’ve written this method which should check for file changes.
public static void watch()
{
FileSystemWatcher watcher = new FileSystemWatcher();
watcher.Path = ConfigurationManager.AppSettings["OpticusFileLoc"];
watcher.Filter = "sigtrades.xml";
watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite
| NotifyFilters.FileName | NotifyFilters.DirectoryName;
// watcher.Created += new FileSystemEventHandler(OnChanged);
watcher.Changed += new FileSystemEventHandler(OnChanged);
watcher.EnableRaisingEvents = true;
}
However, I get this error:
“No overload for ‘OnChanged’ matches delegate ‘System.IO.SystemEventHandler’
Where am I going wrong?
Your
OnChangedmethod needs to have the following signature:Does it?