Upraviť

Zdieľať cez


FileSystemWatcher.WaitForChanged Method

Definition

A synchronous method that returns a structure that contains specific information on the change that occurred.

Overloads

WaitForChanged(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.

WaitForChanged(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.

WaitForChanged(WatcherChangeTypes, TimeSpan)

Synchronously returns a structure that contains specific information on the change that occurred, given the type of change to monitor.

WaitForChanged(WatcherChangeTypes)

Source:
FileSystemWatcher.cs
Source:
FileSystemWatcher.cs
Source:
FileSystemWatcher.cs

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.

public:
 System::IO::WaitForChangedResult WaitForChanged(System::IO::WatcherChangeTypes changeType);
public System.IO.WaitForChangedResult WaitForChanged (System.IO.WatcherChangeTypes changeType);
member this.WaitForChanged : System.IO.WatcherChangeTypes -> System.IO.WaitForChangedResult
Public Function WaitForChanged (changeType As WatcherChangeTypes) As WaitForChangedResult

Parameters

changeType
WatcherChangeTypes

The WatcherChangeTypes to watch for.

Returns

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.

Note

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

See also

Applies to

WaitForChanged(WatcherChangeTypes, Int32)

Source:
FileSystemWatcher.cs
Source:
FileSystemWatcher.cs
Source:
FileSystemWatcher.cs

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.

public:
 System::IO::WaitForChangedResult WaitForChanged(System::IO::WatcherChangeTypes changeType, int timeout);
public System.IO.WaitForChangedResult WaitForChanged (System.IO.WatcherChangeTypes changeType, int timeout);
member this.WaitForChanged : System.IO.WatcherChangeTypes * int -> System.IO.WaitForChangedResult
Public Function WaitForChanged (changeType As WatcherChangeTypes, timeout As Integer) As WaitForChangedResult

Parameters

changeType
WatcherChangeTypes

The WatcherChangeTypes to watch for.

timeout
Int32

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

Returns

A WaitForChangedResult that contains specific information on the change that occurred.

Remarks

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

Note

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

See also

Applies to

WaitForChanged(WatcherChangeTypes, TimeSpan)

Source:
FileSystemWatcher.cs
Source:
FileSystemWatcher.cs
Source:
FileSystemWatcher.cs

Synchronously returns a structure that contains specific information on the change that occurred, given the type of change to monitor.

public:
 System::IO::WaitForChangedResult WaitForChanged(System::IO::WatcherChangeTypes changeType, TimeSpan timeout);
public System.IO.WaitForChangedResult WaitForChanged (System.IO.WatcherChangeTypes changeType, TimeSpan timeout);
member this.WaitForChanged : System.IO.WatcherChangeTypes * TimeSpan -> System.IO.WaitForChangedResult
Public Function WaitForChanged (changeType As WatcherChangeTypes, timeout As TimeSpan) As WaitForChangedResult

Parameters

changeType
WatcherChangeTypes

The WatcherChangeTypes to watch for.

timeout
TimeSpan

The amount of time to wait before timing out.

Returns

A WaitForChangedResult that contains specific information on the change that occurred.

Remarks

See WaitForChanged(WatcherChangeTypes, Int32) remarks.

Applies to