SearchOption Enumeration

SearchOption Enumeration

 

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)>]
type SearchOption

Member nameDescription
AllDirectories

Includes the current directory and all its subdirectories in a search operation. This option includes reparse points such as mounted drives and symbolic links in the search.

TopDirectoryOnly

Includes only the current directory in a search operation.

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 example lists all the directories and files that begin with the letter "c", as in "c:\". In this example, the SearchOption is used to specify that only the top-level directory should be searched.

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

Universal Windows Platform
Available since 10
.NET Framework
Available since 2.0
Silverlight
Available since 4.0
Return to top
Show:
© 2016 Microsoft