EpLibrary.cs.FolderHelper.GetDirList C# (CSharp) Method

GetDirList() public static method

Get the directory and file list of given path
public static GetDirList ( string dirPath ) : List
dirPath string the folder path
return List
        public static List<string> GetDirList(string dirPath)
        {
            DirectoryInfo dir = new DirectoryInfo(dirPath);
            List<string> dirList = new List<string>();
            try
            {

                foreach (DirectoryInfo d in dir.GetDirectories())
                {
                    dirList.Add(d.Name + "\\");
                }
                foreach (FileInfo f in dir.GetFiles())
                {
                    //Console.WriteLine("File {0}", f.FullName);
                    dirList.Add(f.Name);
                }
            }
            catch(Exception ex)
            {
                Console.WriteLine(ex.Message + " >" + ex.StackTrace);
            }
            return dirList;
        }
    }