System.IO.DirectoryInfo.EnumerateFiles Method

Returns an enumerable collection of file information in the current directory.

Syntax

public IEnumerable<FileInfo> EnumerateFiles ()

Returns

An enumerable collection of the files in the current directory.

Remarks

The DirectoryInfo.EnumerateFiles and DirectoryInfo.GetFiles methods differ as follows:

Therefore, when you are working with many files and directories, DirectoryInfo.EnumerateFiles can be more efficient.

This method pre-populates the values of the following System.IO.FileInfo properties:

The returned collection is not cached; each call to the IEnumerable`1.GetEnumerator method on the collection will start a new enumeration.

Requirements

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