I have below code written in C# console app, basically it's watching a folder Temp
where it will watch for test.txt
file updates.
class Program
{
private static FileSystemWatcher watcher;
static void Main(string[] args)
{
watcher = new FileSystemWatcher("C:\\Temp\\", "test.txt");
watcher.Changed += EventCall;
watcher.EnableRaisingEvents = true;
Console.ReadKey();
}
private static void EventCall(object sender, FileSystemEventArgs e)
{
Console.WriteLine("update done");
}
}
When test.txt
file updated, EventCall
method called 2 times, whats changed needs to be done so that event should called only 1 time?