I am creating a FileInfo array like this
try { DirectoryInfo Dir = new DirectoryInfo(DirPath); FileInfo[] FileList = Dir.GetFiles("*.*", SearchOption.AllDirectories); foreach (FileInfo FI in FileList) { Console.WriteLine(FI.FullName); } } catch (Exception e) { Console.WriteLine(e.ToString()); }
And this array contains all the file names in the = DirPath folder
I thought about iterating over the FileInfo array and copying it to the String array. Is this normal or is there a cleaner method?
klijo source share