C# Directory GetFileSystemEntries(String)

Description

Directory GetFileSystemEntries(String) Returns the names of all files and subdirectories in the specified directory.

Syntax

Directory.GetFileSystemEntries(String) has the following syntax.


public static string[] GetFileSystemEntries(
  string path
)

Parameters

Directory.GetFileSystemEntries(String) has the following parameters.

  • path - The directory for which file and subdirectory names are returned.

Returns

Directory.GetFileSystemEntries(String) method returns

Example

The following example uses the GetFileSystemEntries method.


using System;//from  ww  w.j  a va  2s . co m

class Class1 
{
    static void Main(string[] args) 
    {
        string[] directoryEntries = System.IO.Directory.GetFileSystemEntries("."); 

        foreach (string str in directoryEntries) 
        {
            System.Console.WriteLine(str);
        }
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.IO »




BinaryReader
BinaryWriter
Directory
DirectoryInfo
DriveInfo
File
FileInfo
FileStream
MemoryStream
Path
StreamReader
StreamWriter
StringReader
StringWriter