FileSystemWatcher.IncludeSubdirectories 属性
获取或设置一个值,该值指示是否监视指定路径中的子目录。
**命名空间:**System.IO
**程序集:**System(在 system.dll 中)
语法
声明
Public Property IncludeSubdirectories As Boolean
用法
Dim instance As FileSystemWatcher
Dim value As Boolean
value = instance.IncludeSubdirectories
instance.IncludeSubdirectories = value
public bool IncludeSubdirectories { get; set; }
public:
property bool IncludeSubdirectories {
bool get ();
void set (bool value);
}
/** @property */
public boolean get_IncludeSubdirectories ()
/** @property */
public void set_IncludeSubdirectories (boolean value)
public function get IncludeSubdirectories () : boolean
public function set IncludeSubdirectories (value : boolean)
属性值
如果要监视子目录,则为 true;否则为 false。默认为 false。
备注
如果要监视通过 Path 属性指定的目录(及其子目录)内包含的文件和目录的更改通知,请将 IncludeSubdirectories 设置为 true。将 IncludeSubdirectories 属性设置为 false 可帮助减少发送给内部缓冲区的通知数。有关筛选掉不想要的通知的更多信息,请参见 NotifyFilter 和 InternalBufferSize 属性。
当为 true 时,IncludeSubdirectories 递归通过整个子树,而不仅仅是直接子目录。根据正在监视的更改,到子树内文件或目录的相对路径在 FileSystemEventArgs 的 Name 属性和 RenamedEventArgs 的 OldName 属性中返回。根据正在监视的更改,可从 FileSystemEventArgs 的 FullPath 属性和 RenamedEventArgs 的 OldFullPath 属性获取完全限定的路径。
如果目录是在所监视的目录的子树中创建的,而且 IncludeSubdirectories 为 true,那么将自动监视该目录。
平台
Windows 98、Windows 2000 SP4、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition
.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求。
版本信息
.NET Framework
受以下版本支持:2.0、1.1、1.0
请参见
参考
FileSystemWatcher 类
FileSystemWatcher 成员
System.IO 命名空间
NotifyFilter
FileSystemEventArgs 类
FileSystemWatcher.Filter 属性
FileSystemEventArgs.FullPath 属性
RenamedEventArgs.OldFullPath
InternalBufferSize
FileSystemEventArgs.Name 属性
RenamedEventArgs.OldName
Path
RenamedEventArgs