FileSystemWatcher.WaitForChanged Method (WatcherChangeTypes, Int32)

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 and the time (in milliseconds) to wait before timing out.

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

public WaitForChangedResult WaitForChanged(
	WatcherChangeTypes changeType,
	int timeout
)

Parameters

changeType
Type: System.IO.WatcherChangeTypes

The WatcherChangeTypes to watch for.

timeout
Type: System.Int32

The time (in milliseconds) to wait before timing out.

Return Value

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

This method waits until a change occurs or it has timed out. A value of -1 for the timeout parameter means wait indefinitely.

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".

.NET Framework

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

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft