I am using the DirectoryInfo.GetFiles method to search directories for a certain file type. The GetFiles method returns a FileInfo file list. I have several directories that I need to search, so I need to combine several FileInfo arrays that I need to combine. What is the best way to combine these arrays, or is there a better solution?
Here is the code. I have a loop where I am passing a path into the function, and it find all of the PDFs in the subdirectories. I need to combine the FileInfo arrays in the loop.
Private Function FindAllPDFsInArchives(ByVal Archives As DataTable) As FileInfo()
Dim strArchiveFullPath As String
For i As Integer = 0 To Archives.Rows.Count - 1
strArchiveFullPath = Archives.Rows(i).Item("PATH").ToString.Trim()
aAllDocsInArchive = SelectAllDocsInArchive(
Public Function SelectAllDocsInArchive(ByVal DirPath as String) As FileInfo()
Dim archiveFolder As DirectoryInfo
Dim findFiles As FileInfo() = Nothing
Dim strFullPathToDoc As String = DirPath
archiveFolder = New DirectoryInfo(strFullPathToDoc)
findFiles = archiveFolder.GetFiles("*.PDF", SearchOption.AllDirectories)
Catch ex As Exception