public static void FillFromDirectories(string[] dirs) { foreach (var dir in dirs) { if (!Directory.Exists(dir)) { continue; } int i = 1; // Very simple document ID var files = Directory.GetFiles(dir, "*.pdf"); foreach (var file in files) { FileInfo fi = new FileInfo(file); var docInfo = new PDFDocumentFile(fi.Name, i, fi.FullName, (int)fi.Length); _pdfFilesInfo.Add(docInfo); i++; } } }