Platform Core .NET Assemblies API
EnumerateDirectories Method
See Also  Send Feedback
Terrasoft.IO Namespace > IDirectoryInfo Interface : EnumerateDirectories Method
searchPattern
The search string to match against the names of directories. This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions. The default pattern is "*", which returns all files.
searchOption
One of the enumeration values that specifies whether the search operation should include only the current directory or all subdirectories. The default value is System.IO.SearchOption.TopDirectoryOnly.

Glossary Item Box

Returns an enumerable collection of directory information that matches a specified search pattern and search subdirectory option.

Syntax

 
C#
 
 

Parameters

searchPattern
The search string to match against the names of directories. This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions. The default pattern is "*", which returns all files.
searchOption
One of the enumeration values that specifies whether the search operation should include only the current directory or all subdirectories. The default value is System.IO.SearchOption.TopDirectoryOnly.

Return Value

An enumerable collection of directories that matches searchPattern and searchOption.

Exceptions

ExceptionDescription
System.ArgumentNullExceptionsearchPattern is null.
System.ArgumentOutOfRangeExceptionsearchOption is not a valid System.IO.SearchOption value.
System.IO.DirectoryNotFoundExceptionThe specified path is invalid (for example, it is on an unmapped drive).
System.Security.SecurityExceptionThe caller does not have the required permission.

Remarks

The following wildcard specifiers are permitted in searchPattern. * (asterisk) - Zero or more characters in that position. ? (question mark) - Zero or one character in that position. Characters other than the wildcard are literal characters. For example, the searchPattern string "*t" searches for all names in path ending with the letter "t". The searchPattern string "s*" searches for all names in path beginning with the letter "s". searchPattern cannot end in two periods ("..") or contain two periods ("..") followed by '/' or '\', nor can it contain any invalid characters.

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

© Terrasoft 2002-2018.