Changed Event
Collapse the table of content
Expand the table of content

FileSystemWatcher.Changed Event

 

Occurs when a file or directory in the specified Path is changed.

Namespace:   System.IO
Assembly:  System (in System.dll)

[<IODescriptionAttribute("FSW_Changed")>]
member Changed : IEvent<FileSystemEventHandler,
    FileSystemEventArgs>

The Changed event is raised when changes are made to the size, system attributes, last write time, last access time, or security permissions of a file or directory in the directory being monitored.

System_CAPS_noteNote

Common file system operations might raise more than one event. For example, when a file is moved from one directory to another, several OnChanged and some OnCreated and OnDeleted events might be raised. Moving a file is a complex operation that consists of multiple simple operations, therefore raising multiple events. Likewise, some applications (for example, antivirus software) might cause additional file system events that are detected by FileSystemWatcher.

Use NotifyFilter to restrict the number of notifications raised when this event is handled.

System_CAPS_noteNote

The Changed event is raised unexpectedly when a file is renamed, but is not raised when a directory is renamed. To watch for renaming, use the Renamed event.

System_CAPS_noteNote

The order in which the Changed event is raised in relation to the other FileSystemWatcher events may change when the SynchronizingObject property is not null.

The following example uses the Changed event to display the file path to the console whenever the watched file is changed.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 10
.NET Framework
Available since 1.1
Return to top
Show:
© 2016 Microsoft