System.IO.DirectoryInfo.EnumerateDirectories Method

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

Syntax

public IEnumerable<DirectoryInfo> EnumerateDirectories ()

Returns

An enumerable collection of directories in the current directory.

Remarks

The DirectoryInfo.EnumerateDirectories and DirectoryInfo.GetDirectories methods differ as follows:

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

This method pre-populates the values of the following System.IO.DirectoryInfo 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