I have an application where I am looking for a text file and if there are any changes made to the file I am using the OnChanged eventhandler to handle the event
OnChanged
FileReadTime = DateTime.Now; private void File_Changed(object sender, FileSystemEventArgs e) { var lastWriteTime = File.GetLastWriteTime(e.FullPath); if (lastWriteTime.Subtract(FileReadTime).Ticks > 0) { // code FileReadTime = DateTime.Now; } }