System.IO.DirectoryInfo.GetFiles Method

Returns a file list from the current directory.

Syntax

public FileInfo[] GetFiles ()

Returns

An array of type System.IO.FileInfo.

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.

If there are no files in the System.IO.DirectoryInfo, this method returns an empty array.

The order of the returned file names is not guaranteed; use the erload:System.Array.Sort method if a specific sort order is required.

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

Requirements

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