List files under a directory : Directory : File Directory Stream C# Examples


C# Examples » File Directory Stream » Directory »

 

List files under a directory









    
using  System;
using  System.IO;

public  class  MainClass
{
    static  void  Main(string[]  args)
    {
        DirectoryInfo  MyRoot  =  new  DirectoryInfo(@"c:\projects");
        FileInfo[]  MyFiles  =  MyRoot.GetFiles();
        foreach  (FileInfo  F  in  MyFiles)
        {
            Console.WriteLine(F.Name);
        }

    }
}
    
   
  
   



Output

Testing.txt


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo File Directory Stream
» Directory