Export (0) Print
Expand All

SearchOption Enumeration

Note: This enumeration is new in the .NET Framework version 2.0.

Specifies whether to search the current directory, or the current directory and all subdirectories.

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

[SerializableAttribute] 
[ComVisibleAttribute(true)] 
public enum class SearchOption
/** @attribute SerializableAttribute() */ 
/** @attribute ComVisibleAttribute(true) */ 
public enum SearchOption
SerializableAttribute 
ComVisibleAttribute(true) 
public enum SearchOption

 Member nameDescription
AllDirectoriesIncludes the current directory and all the subdirectories in a search operation. This option includes reparse points like mounted drives and symbolic links in the search. 
TopDirectoryOnlyIncludes only the current directory in a search. 

If you choose AllDirectories in your search and the directory structure contains a link that creates a loop, the search operation enters an infinite loop.

The following code example lists all of the directories and files that begin with the letter "c" in "c:\". In this example, the SearchOption is used to specify not to search all subdirectories.

No code example is currently available or this language may not be supported.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

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

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2014 Microsoft