EnumerateFiles Method
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Returns an enumerable collection of file names in a specified path.
Namespace: System.IO
Assembly: System.IO (in System.IO.dll)
Syntax
'Declaration
Public Shared Function EnumerateFiles ( _
path As String _
) As IEnumerable
public static IEnumerable EnumerateFiles(
string path
)
public:
static IEnumerable^ EnumerateFiles(
String^ path
)
static member EnumerateFiles :
path:string -> IEnumerable
public static function EnumerateFiles(
path : String
) : IEnumerable
Parameters
- path
Type: System. . :: . .String
The directory to search.
Return Value
Type: System.Collections. . :: . .IEnumerable
An enumerable collection of the full names (including paths) for the files in the directory specified by path.
Remarks
You can specify relative path information with the path parameter. Relative path information is interpreted as relative to the current working directory, which you can determine by using the GetCurrentDirectory method.
The EnumerateFiles and GetFiles methods differ as follows: When you use EnumerateFiles, you can start enumerating the collection of names before the whole collection is returned; when you use GetFiles, you must wait for the whole array of names to be returned before you can access the array. Therefore, when you are working with many files and directories, EnumerateFiles can be more efficient.
The returned collection is not cached; each call to the GetEnumerator on the collection will start a new enumeration.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see dd66cd4c-b087-415f-9c3e-94e3a1835f74.