10/19/2017 - 11:16 AM


' For complete examples and data files, please go to
Namespace System.IO
    Public Module MyExtesion
        <Runtime.CompilerServices.Extension()> _
        Public Function GetFiles(directoryInfo As Global.System.IO.DirectoryInfo, documentType As DocumentType) As Global.System.IO.FileInfo()
            Dim files As Global.System.IO.FileInfo() = directoryInfo.GetFiles()

            ' return empty array if directory is empty
            If files.Length = 0 Then
                Return New Global.System.IO.FileInfo(-1) {}
            End If

            Dim result As New List(Of Global.System.IO.FileInfo)()

            For Each fileInfo As Global.System.IO.FileInfo In files
                Using fileFormatChecker As New FileFormatChecker(fileInfo.FullName)
                    If fileFormatChecker.VerifyFormat(documentType) Then
                    End If
                End Using

            Return result.ToArray()
        End Function
    End Module
End Namespace