Skip to main content
.NET Framework Class Library
FileSystemWatcher..::.WaitForChanged Method (WatcherChangeTypes)

A synchronous method that returns a structure that contains specific information on the change that occurred, given the type of change you want to monitor.

Namespace: System.IO
Assembly: System (in System.dll)
Syntax
Public Function WaitForChanged ( _
	changeType As WatcherChangeTypes _
) As WaitForChangedResult
public WaitForChangedResult WaitForChanged(
	WatcherChangeTypes changeType
)
public:
WaitForChangedResult WaitForChanged(
	WatcherChangeTypes changeType
)
member WaitForChanged : 
        changeType:WatcherChangeTypes -> WaitForChangedResult 

Parameters

changeType
Type: System.IO..::.WatcherChangeTypes
The WatcherChangeTypes to watch for.

Return Value

Type: System.IO..::.WaitForChangedResult
A WaitForChangedResult that contains specific information on the change that occurred.
Remarks

This method waits indefinitely until the first change occurs and then returns. This is the same as using WaitForChanged with the timeout parameter set to -1.

NoteNote

This method allows an event handler to be invoked to respond to file changes even if the EnableRaisingEvents property is set to false.

In some systems, FileSystemWatcher reports changes to files using the short 8.3 file name format. For example, a change to "LongFileName.LongExtension" could be reported as "LongFi~.Lon".

Version Information

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Platforms

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.