I have the two following arrays:
string[] files = Directory.GetFiles(e.Volume.RootDirectory);
string[] folders = Directory.GetDirectories(e.Volume.RootDirectory);
I am searching for a method to combine these into a single array. Does anyone have a tip on how to do this?
Regards,
Aaron
randoom
2
string[] combined = new string[files.Length + folders.Length];
Array.Copy(files, 0, combined, 0, files.Length);
Array.Copy(folders, 0, combined, files.Length, folders.Length);
This will also do the same job.
Choose one
var strArray = Array.CreateInstance(typeof(string), files.Length + folders.Length);
OR
var strArray = new string[files.Length + folders.Length];
files.CopyTo(strArray, 0);
folders.CopyTo(strArray, files.Length);
wow, thats a relief, thanks both of you.