Partager via


IFileSystemProvider.WatchDirectoryAsync Method

Definition

Starts watching a directory for changes. A DirectoryEntryChanged event occurs under the following circumstances:

1. A file in the directory specified by uri is created, deleted, or modified.

2. A child directory in the directory specified by uri is created or deleted.

3. If recursive is true, a change described by #1 or #2 occurs in any child directory of the directory specified by uri.

public:
 System::Threading::Tasks::ValueTask<Microsoft::VisualStudio::RpcContracts::FileSystem::WatchResult ^> WatchDirectoryAsync(Uri ^ uri, bool recursive, System::Threading::CancellationToken cancellationToken);
public System.Threading.Tasks.ValueTask<Microsoft.VisualStudio.RpcContracts.FileSystem.WatchResult> WatchDirectoryAsync (Uri uri, bool recursive, System.Threading.CancellationToken cancellationToken);
abstract member WatchDirectoryAsync : Uri * bool * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Microsoft.VisualStudio.RpcContracts.FileSystem.WatchResult>
Public Function WatchDirectoryAsync (uri As Uri, recursive As Boolean, cancellationToken As CancellationToken) As ValueTask(Of WatchResult)

Parameters

uri
Uri

The directory to be watched.

recursive
Boolean

Indicates whether subdirectories should be watched.

cancellationToken
CancellationToken

The cancellation token.

Returns

An object which can be passed to UnwatchAsync(WatchResult, CancellationToken) to stop watching the directory.

Exceptions

uri is null.

Applies to