DirectoryInfo.EnumerateFileSystemInfos Método

Definição

Retorna uma coleção enumerável de informações do sistema de arquivos no diretório atual.Returns an enumerable collection of file system information in the current directory.

Sobrecargas

EnumerateFileSystemInfos(String, SearchOption)

Retorna uma coleção enumerável de informações do sistema de arquivos que corresponde a um padrão de pesquisa especificado e a uma opção de subdiretório de pesquisa.Returns an enumerable collection of file system information that matches a specified search pattern and search subdirectory option.

EnumerateFileSystemInfos()

Retorna uma coleção enumerável de informações do sistema de arquivos no diretório atual.Returns an enumerable collection of file system information in the current directory.

EnumerateFileSystemInfos(String)

Retorna uma coleção enumerável de informações do sistema de arquivos que correspondem a um padrão de pesquisa especificado.Returns an enumerable collection of file system information that matches a specified search pattern.

EnumerateFileSystemInfos(String, EnumerationOptions)

Retorna uma coleção enumerável de informações de arquivo que correspondem às opções especificadas de padrão de pesquisa e enumeração.Returns an enumerable collection of file system information that matches the specified search pattern and enumeration options.

EnumerateFileSystemInfos(String, SearchOption)

Retorna uma coleção enumerável de informações do sistema de arquivos que corresponde a um padrão de pesquisa especificado e a uma opção de subdiretório de pesquisa.Returns an enumerable collection of file system information that matches a specified search pattern and search subdirectory option.

public:
 System::Collections::Generic::IEnumerable<System::IO::FileSystemInfo ^> ^ EnumerateFileSystemInfos(System::String ^ searchPattern, System::IO::SearchOption searchOption);
public System.Collections.Generic.IEnumerable<System.IO.FileSystemInfo> EnumerateFileSystemInfos (string searchPattern, System.IO.SearchOption searchOption);
member this.EnumerateFileSystemInfos : string * System.IO.SearchOption -> seq<System.IO.FileSystemInfo>
Public Function EnumerateFileSystemInfos (searchPattern As String, searchOption As SearchOption) As IEnumerable(Of FileSystemInfo)

Parâmetros

searchPattern
String

A cadeia de caracteres de pesquisa para correspondência em relação aos nomes dos diretórios.The search string to match against the names of directories. Esse parâmetro pode conter uma combinação de caracteres curinga (* e ?) e caminho de literal, mas não dá suporte a expressões regulares.This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.

searchOption
SearchOption

Um dos valores de enumeração que especifica se a operação de pesquisa deve incluir somente o diretório atual ou todos os subdiretórios.One of the enumeration values that specifies whether the search operation should include only the current directory or all subdirectories. O valor padrão é TopDirectoryOnly.The default value is TopDirectoryOnly.

Retornos

IEnumerable<FileSystemInfo>

Uma coleção enumerável de objetos de informações do sistema de arquivos que corresponde a searchPattern e searchOption.An enumerable collection of file system information objects that matches searchPattern and searchOption.

Exceções

searchPattern é null.searchPattern is null.

searchOption não é um valor SearchOption válido.searchOption is not a valid SearchOption value.

O caminho encapsulado no objeto DirectoryInfo é inválido (por exemplo, está em uma unidade não mapeada).The path encapsulated in the DirectoryInfo object is invalid (for example, it is on an unmapped drive).

O chamador não tem a permissão necessária.The caller does not have the required permission.

Comentários

searchPattern pode ser uma combinação de caracteres literais e curinga, mas não oferece suporte a expressões regulares.searchPattern can be a combination of literal and wildcard characters, but it doesn't support regular expressions. Os especificadores curinga a seguir são permitidos no searchPattern .The following wildcard specifiers are permitted in searchPattern.

Especificador de curingaWildcard specifier Corresponde aMatches
* asterisco* (asterisk) Zero ou mais caracteres nessa posição.Zero or more characters in that position.
?? (ponto de interrogação)(question mark) Zero ou um caractere nessa posição.Zero or one character in that position.

Caracteres diferentes do curinga são caracteres literais.Characters other than the wildcard are literal characters. Por exemplo, a cadeia de caracteres " * t" procura todos os nomes que terminam com a letra "t".For example, the string "*t" searches for all names in ending with the letter "t". ".". A searchPattern cadeia de caracteres "s * " pesquisa todos os nomes no path início com a letra "s".The searchPattern string "s*" searches for all names in path beginning with the letter "s".

Os EnumerateFileSystemInfos GetFileSystemInfos métodos e são diferentes da seguinte maneira:The EnumerateFileSystemInfos and GetFileSystemInfos methods differ as follows:

Portanto, quando você estiver trabalhando com muitos arquivos e diretórios, o EnumerateFileSystemInfos poderá ser mais eficiente.Therefore, when you are working with many files and directories, EnumerateFileSystemInfos can be more efficient.

Esse método popula previamente os valores das seguintes FileSystemInfo Propriedades:This method pre-populates the values of the following FileSystemInfo properties:

A coleção retornada não está armazenada em cache; cada chamada para o GetEnumerator método na coleção iniciará uma nova enumeração.The returned collection is not cached; each call to the GetEnumerator method on the collection will start a new enumeration.

Confira também

Aplica-se a

EnumerateFileSystemInfos()

Retorna uma coleção enumerável de informações do sistema de arquivos no diretório atual.Returns an enumerable collection of file system information in the current directory.

public:
 System::Collections::Generic::IEnumerable<System::IO::FileSystemInfo ^> ^ EnumerateFileSystemInfos();
public System.Collections.Generic.IEnumerable<System.IO.FileSystemInfo> EnumerateFileSystemInfos ();
member this.EnumerateFileSystemInfos : unit -> seq<System.IO.FileSystemInfo>
Public Function EnumerateFileSystemInfos () As IEnumerable(Of FileSystemInfo)

Retornos

IEnumerable<FileSystemInfo>

Uma coleção enumerável de informações do sistema de arquivos no diretório atual.An enumerable collection of file system information in the current directory.

Exceções

O caminho encapsulado no objeto DirectoryInfo é inválido (por exemplo, está em uma unidade não mapeada).The path encapsulated in the DirectoryInfo object is invalid (for example, it is on an unmapped drive).

O chamador não tem a permissão necessária.The caller does not have the required permission.

Comentários

Os EnumerateFileSystemInfos GetFileSystemInfos métodos e são diferentes da seguinte maneira:The EnumerateFileSystemInfos and GetFileSystemInfos methods differ as follows:

Portanto, quando você estiver trabalhando com muitos arquivos e diretórios, o EnumerateFileSystemInfos poderá ser mais eficiente.Therefore, when you are working with many files and directories, EnumerateFileSystemInfos can be more efficient.

Esse método popula previamente os valores das seguintes FileSystemInfo Propriedades:This method pre-populates the values of the following FileSystemInfo properties:

A coleção retornada não está armazenada em cache; cada chamada para o GetEnumerator método na coleção iniciará uma nova enumeração.The returned collection is not cached; each call to the GetEnumerator method on the collection will start a new enumeration.

Confira também

Aplica-se a

EnumerateFileSystemInfos(String)

Retorna uma coleção enumerável de informações do sistema de arquivos que correspondem a um padrão de pesquisa especificado.Returns an enumerable collection of file system information that matches a specified search pattern.

public:
 System::Collections::Generic::IEnumerable<System::IO::FileSystemInfo ^> ^ EnumerateFileSystemInfos(System::String ^ searchPattern);
public System.Collections.Generic.IEnumerable<System.IO.FileSystemInfo> EnumerateFileSystemInfos (string searchPattern);
member this.EnumerateFileSystemInfos : string -> seq<System.IO.FileSystemInfo>
Public Function EnumerateFileSystemInfos (searchPattern As String) As IEnumerable(Of FileSystemInfo)

Parâmetros

searchPattern
String

A cadeia de caracteres de pesquisa para correspondência em relação aos nomes dos diretórios.The search string to match against the names of directories. Esse parâmetro pode conter uma combinação de caracteres curinga (* e ?) e caminho de literal, mas não dá suporte a expressões regulares.This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.

Retornos

IEnumerable<FileSystemInfo>

Uma coleção enumerável de objetos de informações do sistema de arquivos que corresponde a searchPattern.An enumerable collection of file system information objects that matches searchPattern.

Exceções

searchPattern é null.searchPattern is null.

O caminho encapsulado no objeto DirectoryInfo é inválido (por exemplo, está em uma unidade não mapeada).The path encapsulated in the DirectoryInfo object is invalid (for example, it is on an unmapped drive).

O chamador não tem a permissão necessária.The caller does not have the required permission.

Comentários

searchPattern pode ser uma combinação de caracteres literais e curinga, mas não oferece suporte a expressões regulares.searchPattern can be a combination of literal and wildcard characters, but it doesn't support regular expressions. Os especificadores curinga a seguir são permitidos no searchPattern .The following wildcard specifiers are permitted in searchPattern.

Especificador de curingaWildcard specifier Corresponde aMatches
* asterisco* (asterisk) Zero ou mais caracteres nessa posição.Zero or more characters in that position.
?? (ponto de interrogação)(question mark) Zero ou um caractere nessa posição.Zero or one character in that position.

Caracteres diferentes do curinga são caracteres literais.Characters other than the wildcard are literal characters. Por exemplo, a cadeia de caracteres " * t" procura todos os nomes que terminam com a letra "t".For example, the string "*t" searches for all names in ending with the letter "t". ".". A searchPattern cadeia de caracteres "s * " pesquisa todos os nomes no path início com a letra "s".The searchPattern string "s*" searches for all names in path beginning with the letter "s".

Os EnumerateFileSystemInfos GetFileSystemInfos métodos e são diferentes da seguinte maneira:The EnumerateFileSystemInfos and GetFileSystemInfos methods differ as follows:

Portanto, quando você estiver trabalhando com muitos arquivos e diretórios, o EnumerateFileSystemInfos poderá ser mais eficiente.Therefore, when you are working with many files and directories, EnumerateFileSystemInfos can be more efficient.

Esse método popula previamente os valores das seguintes FileSystemInfo Propriedades:This method pre-populates the values of the following FileSystemInfo properties:

A coleção retornada não está armazenada em cache; cada chamada para o GetEnumerator método na coleção iniciará uma nova enumeração.The returned collection is not cached; each call to the GetEnumerator method on the collection will start a new enumeration.

Confira também

Aplica-se a

EnumerateFileSystemInfos(String, EnumerationOptions)

Retorna uma coleção enumerável de informações de arquivo que correspondem às opções especificadas de padrão de pesquisa e enumeração.Returns an enumerable collection of file system information that matches the specified search pattern and enumeration options.

public:
 System::Collections::Generic::IEnumerable<System::IO::FileSystemInfo ^> ^ EnumerateFileSystemInfos(System::String ^ searchPattern, System::IO::EnumerationOptions ^ enumerationOptions);
public System.Collections.Generic.IEnumerable<System.IO.FileSystemInfo> EnumerateFileSystemInfos (string searchPattern, System.IO.EnumerationOptions enumerationOptions);
member this.EnumerateFileSystemInfos : string * System.IO.EnumerationOptions -> seq<System.IO.FileSystemInfo>
Public Function EnumerateFileSystemInfos (searchPattern As String, enumerationOptions As EnumerationOptions) As IEnumerable(Of FileSystemInfo)

Parâmetros

searchPattern
String

A cadeia de caracteres de pesquisa para correspondência em relação aos nomes dos diretórios.The search string to match against the names of directories. Esse parâmetro pode conter uma combinação de caracteres curinga (* e ?) e caminho de literal, mas não dá suporte a expressões regulares.This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.

enumerationOptions
EnumerationOptions

Um objeto que descreve a configuração de pesquisa e enumeração a ser usada.An object that describes the search and enumeration configuration to use.

Retornos

IEnumerable<FileSystemInfo>

Uma coleção enumerável de objetos de informações do sistema de arquivos que corresponde a searchPattern e enumerationOptions.An enumerable collection of file system information objects that matches searchPattern and enumerationOptions.

Exceções

searchPattern é null.searchPattern is null.

O caminho encapsulado no objeto DirectoryInfo é inválido (por exemplo, está em uma unidade não mapeada).The path encapsulated in the DirectoryInfo object is invalid (for example, it is on an unmapped drive).

O chamador não tem a permissão necessária.The caller does not have the required permission.

Comentários

searchPattern pode ser uma combinação de caracteres literais e curinga, mas não oferece suporte a expressões regulares.searchPattern can be a combination of literal and wildcard characters, but it doesn't support regular expressions. Os especificadores curinga a seguir são permitidos no searchPattern .The following wildcard specifiers are permitted in searchPattern.

Especificador de curingaWildcard specifier Corresponde aMatches
* asterisco* (asterisk) Zero ou mais caracteres nessa posição.Zero or more characters in that position.
?? (ponto de interrogação)(question mark) Zero ou um caractere nessa posição.Zero or one character in that position.

Caracteres diferentes do curinga são caracteres literais.Characters other than the wildcard are literal characters. Por exemplo, a cadeia de caracteres " * t" procura todos os nomes que terminam com a letra "t".For example, the string "*t" searches for all names in ending with the letter "t". ".". A searchPattern cadeia de caracteres "s * " pesquisa todos os nomes no path início com a letra "s".The searchPattern string "s*" searches for all names in path beginning with the letter "s".

Os EnumerateFileSystemInfos GetFileSystemInfos métodos e são diferentes da seguinte maneira:The EnumerateFileSystemInfos and GetFileSystemInfos methods differ as follows:

Portanto, quando você estiver trabalhando com muitos arquivos e diretórios, o EnumerateFileSystemInfos poderá ser mais eficiente.Therefore, when you are working with many files and directories, EnumerateFileSystemInfos can be more efficient.

Esse método popula previamente os valores das seguintes FileSystemInfo Propriedades:This method pre-populates the values of the following FileSystemInfo properties:

A coleção retornada não está armazenada em cache; cada chamada para o GetEnumerator método na coleção iniciará uma nova enumeração.The returned collection is not cached; each call to the GetEnumerator method on the collection will start a new enumeration.

Aplica-se a