private static int ConvertDocFiles(string outDir, int start) { Document document = new Document(); DirectoryInfo downloadedMessageInfo = new DirectoryInfo(outDir); foreach (FileInfo file in downloadedMessageInfo.GetFiles("*.doc*")) { document.LoadFromFile(file.FullName); document.SaveToFile(string.Format("{0}{1:000}.pdf", outDir, start), FileFormat.PDF); document.Close(); file.Delete(); start++; } return start; }
void Main() { // Note: constructors call Factory Method Document[] documents = new Document[2]; documents[0] = new Resume(); documents[1] = new Report(); // Display document pages foreach (Document document in documents) { Console.WriteLine("\n" + document.GetType().Name + "--"); foreach (Page page in document.Pages) { Console.WriteLine(" " + page.GetType().Name); } } }