Partager via


DirectoryInfo.EnumerateFileSystemInfos Method (String)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

When it is called by trusted applications, returns an enumerable collection of file system information that matches a specified search pattern.

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

Syntax

'Declaration
Public Function EnumerateFileSystemInfos ( _
    searchPattern As String _
) As IEnumerable(Of FileSystemInfo)
public IEnumerable<FileSystemInfo> EnumerateFileSystemInfos(
    string searchPattern
)

Parameters

  • searchPattern
    Type: System.String
    The search string. The default pattern is "*", which returns all files and directories.

Return Value

Type: System.Collections.Generic.IEnumerable<FileSystemInfo>
An enumerable collection of file system information objects that matches searchPattern.

Exceptions

Exception Condition
ArgumentNullException

searchPattern is nulla null reference (Nothing in Visual Basic).

DirectoryNotFoundException

The path encapsulated in the FileSystemInfo object is invalid (for example, it is on an unmapped drive).

SecurityException

The caller does not have the required permission.

Remarks

The following wildcard specifiers are permitted in the searchPattern parameter.

Wildcard character

Description

*

Zero or more characters.

?

Exactly one character.

Version Information

Silverlight

Supported in: 5, 4

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.