Returns a file list from the current directory.
Assembly: mscorlib (in mscorlib.dll)
The path is invalid, such as being on an unmapped drive.
Therefore, when you are working with many files and directories, EnumerateFiles can be more efficient.
If there are no files in the DirectoryInfo, this method returns an empty array.
The order of the returned file names is not guaranteed; use the Sort() method if a specific sort order is required.
This method pre-populates the values of the following FileInfo properties:
The following example shows how to get a list of files from a directory by using different search options. The example assumes a directory that has files named log1.txt, log2.txt, test1.txt, test2.txt, test3.txt, and a subdirectory that has a file named SubFile.txt.
Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.